diff options
Diffstat (limited to 'include')
412 files changed, 9832 insertions, 7224 deletions
diff --git a/include/asm-alpha/cache.h b/include/asm-alpha/cache.h index c9b94b76b..5e46073a8 100644 --- a/include/asm-alpha/cache.h +++ b/include/asm-alpha/cache.h @@ -8,5 +8,6 @@ read-allocate, direct-mapped, physical. */ #define L1_CACHE_BYTES 32 #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) +#define SMP_CACHE_BYTES L1_CACHE_BYTES #endif diff --git a/include/asm-alpha/fpu.h b/include/asm-alpha/fpu.h index 333e5caeb..5e56e7db2 100644 --- a/include/asm-alpha/fpu.h +++ b/include/asm-alpha/fpu.h @@ -81,6 +81,18 @@ ieee_swcr_to_fpcr(unsigned long sw) return fp; } +static inline unsigned long +ieee_fpcr_to_swcr(unsigned long fp) +{ + unsigned long sw; + sw = (fp >> 35) & IEEE_STATUS_MASK; + sw |= (~fp >> 48) & (IEEE_TRAP_ENABLE_INV + | IEEE_TRAP_ENABLE_DZE + | IEEE_TRAP_ENABLE_OVF); + sw |= (~fp >> 57) & (IEEE_TRAP_ENABLE_UNF | IEEE_TRAP_ENABLE_INE); + return sw; +} + #ifdef __KERNEL__ /* The following two functions don't need trapb/excb instructions diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index 3074ba8fb..dc976cb5f 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h @@ -287,7 +287,7 @@ static inline void iounmap(void *addr) * String version of IO memory access ops: */ extern void _memcpy_fromio(void *, unsigned long, long); -extern void _memcpy_toio(unsigned long, void *, long); +extern void _memcpy_toio(unsigned long, const void *, long); extern void _memset_c_io(unsigned long, unsigned long, long); #define memcpy_fromio(to,from,len) \ diff --git a/include/asm-alpha/keyboard.h b/include/asm-alpha/keyboard.h index 85a1ea9ae..0761803f7 100644 --- a/include/asm-alpha/keyboard.h +++ b/include/asm-alpha/keyboard.h @@ -3,7 +3,7 @@ * * Created 3 Nov 1996 by Geert Uytterhoeven * - * $Id: keyboard.h,v 1.7 1999/02/10 16:02:26 ralf Exp $ + * $Id: keyboard.h,v 1.8 1999/06/10 08:02:36 ralf Exp $ */ /* @@ -24,7 +24,6 @@ extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); -extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pckbd_unexpected_up(unsigned char keycode); @@ -34,7 +33,6 @@ extern unsigned char pckbd_sysrq_xlate[128]; #define kbd_setkeycode pckbd_setkeycode #define kbd_getkeycode pckbd_getkeycode -#define kbd_pretranslate pckbd_pretranslate #define kbd_translate pckbd_translate #define kbd_unexpected_up pckbd_unexpected_up #define kbd_leds pckbd_leds diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h index dcf1f05d7..03aa3c6d2 100644 --- a/include/asm-alpha/mmu_context.h +++ b/include/asm-alpha/mmu_context.h @@ -14,11 +14,11 @@ /* * The maximum ASN's the processor supports. On the EV4 this is 63 * but the PAL-code doesn't actually use this information. On the - * EV5 this is 127. + * EV5 this is 127, and EV6 has 255. * * On the EV4, the ASNs are more-or-less useless anyway, as they are - * only used as an icache tag, not for TB entries. On the EV5 ASN's - * also validate the TB entries, and thus make a lot more sense. + * only used as an icache tag, not for TB entries. On the EV5 and EV6, + * ASN's also validate the TB entries, and thus make a lot more sense. * * The EV4 ASN's don't even match the architecture manual, ugh. And * I quote: "If a processor implements address space numbers (ASNs), @@ -73,7 +73,7 @@ extern unsigned long last_asn[]; extern unsigned long asn_cache; #endif /* __SMP__ */ -#define WIDTH_HARDWARE_ASN 7 +#define WIDTH_HARDWARE_ASN 8 #define ASN_FIRST_VERSION (1UL << (WIDTH_THIS_PROCESSOR + WIDTH_HARDWARE_ASN)) #define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1) diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index b74744207..308b28af9 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -167,19 +167,6 @@ static inline void flush_tlb_range(struct mm_struct *mm, #else /* __SMP__ */ -/* ipi_msg_flush_tb is owned by the holder of the global kernel lock. */ -struct ipi_msg_flush_tb_struct { - volatile unsigned int flush_tb_mask; - union { - struct mm_struct * flush_mm; - struct vm_area_struct * flush_vma; - } p; - unsigned long flush_addr; - unsigned long flush_end; -}; - -extern struct ipi_msg_flush_tb_struct ipi_msg_flush_tb; - extern void flush_tlb_all(void); extern void flush_tlb_mm(struct mm_struct *); extern void flush_tlb_page(struct vm_area_struct *, unsigned long); @@ -651,5 +638,6 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (0) +#define kern_addr_valid(addr) (1) #endif /* _ALPHA_PGTABLE_H */ diff --git a/include/asm-alpha/semaphore-helper.h b/include/asm-alpha/semaphore-helper.h new file mode 100644 index 000000000..0577d2c93 --- /dev/null +++ b/include/asm-alpha/semaphore-helper.h @@ -0,0 +1,128 @@ +#ifndef _ALPHA_SEMAPHORE_HELPER_H +#define _ALPHA_SEMAPHORE_HELPER_H + +/* + * SMP- and interrupt-safe semaphores helper functions. + * + * (C) Copyright 1996 Linus Torvalds + * (C) Copyright 1999 Richard Henderson + */ + +/* + * These two _must_ execute atomically wrt each other. + * + * This is trivially done with load_locked/store_cond, + * which we have. Let the rest of the losers suck eggs. + */ + +static inline void +wake_one_more(struct semaphore * sem) +{ + atomic_inc(&sem->waking); +} + +static inline int +waking_non_zero(struct semaphore *sem) +{ + long ret, tmp; + + /* An atomic conditional decrement. */ + __asm__ __volatile__( + "1: ldl_l %1,%2\n" + " blt %1,2f\n" + " subl %1,1,%0\n" + " stl_c %0,%2\n" + " beq %0,3f\n" + "2:\n" + ".section .text2,\"ax\"\n" + "3: br 1b\n" + ".previous" + : "=r"(ret), "=r"(tmp), "=m"(__atomic_fool_gcc(&sem->waking)) + : "0"(0)); + + return ret > 0; +} + + +/* + * waking_non_zero_interruptible: + * 1 got the lock + * 0 go to sleep + * -EINTR interrupted + * + * We must undo the sem->count down_interruptible decrement + * simultaneously and atomicly with the sem->waking adjustment, + * otherwise we can race with wake_one_more. + * + * This is accomplished by doing a 64-bit ll/sc on the 2 32-bit words. + */ + +static inline int +waking_non_zero_interruptible(struct semaphore *sem, struct task_struct *tsk) +{ + long ret, tmp, tmp2, tmp3; + + /* "Equivalent" C. Note that we have to do this all without + (taken) branches in order to be a valid ll/sc sequence. + + do { + tmp = ldq_l; + ret = 0; + if (tmp >= 0) { + tmp += 0xffffffff00000000; + ret = 1; + } + else if (pending) { + // Since -1 + 1 carries into the high word, we have + // to be more careful adding 1 here. + tmp = (tmp & 0xffffffff00000000) + | ((tmp + 1) & 0x00000000ffffffff; + ret = -EINTR; + } + else { + break; // ideally. we don't actually break + // since this is a predicate we don't + // have, and is more trouble to build + // than to elide the noop stq_c. + } + tmp = stq_c = tmp; + } while (tmp == 0); + */ + + __asm__ __volatile__( + "1: ldq_l %1,%4\n" + " lda %0,0\n" + " cmovne %5,%6,%0\n" + " addq %1,1,%2\n" + " and %1,%7,%3\n" + " andnot %2,%7,%2\n" + " cmovge %1,1,%0\n" + " or %3,%2,%2\n" + " addq %1,%7,%3\n" + " cmovne %5,%2,%1\n" + " cmovge %2,%3,%1\n" + " stq_c %1,%4\n" + " beq %1,3f\n" + "2:\n" + ".section .text2,\"ax\"\n" + "3: br 1b\n" + ".previous" + : "=&r"(ret), "=&r"(tmp), "=&r"(tmp2), "=&r"(tmp3), "=m"(*sem) + : "r"(signal_pending(tsk)), "r"(-EINTR), + "r"(0xffffffff00000000)); + + return ret; +} + +/* + * waking_non_zero_trylock is unused. we do everything in + * down_trylock and let non-ll/sc hosts bounce around. + */ + +static inline int +waking_non_zero_trylock(struct semaphore *sem) +{ + return 0; +} + +#endif diff --git a/include/asm-alpha/semaphore.h b/include/asm-alpha/semaphore.h index a172211c1..698ce1821 100644 --- a/include/asm-alpha/semaphore.h +++ b/include/asm-alpha/semaphore.h @@ -5,123 +5,38 @@ * SMP- and interrupt-safe semaphores.. * * (C) Copyright 1996 Linus Torvalds + * (C) Copyright 1996 Richard Henderson */ #include <asm/current.h> #include <asm/system.h> #include <asm/atomic.h> -/* - * Semaphores are recursive: we allow the holder process to recursively do - * down() operations on a semaphore that the process already owns. In order - * to do that, we need to keep a semaphore-local copy of the owner and the - * "depth of ownership". - * - * NOTE! Nasty memory ordering rules: - * - "owner" and "owner_count" may only be modified once you hold the lock. - * - "owner_count" must be written _after_ modifying owner, and must be - * read _before_ reading owner. There must be appropriate write and read - * barriers to enforce this. - */ - struct semaphore { + /* Careful, inline assembly knows about the position of these two. */ atomic_t count; - atomic_t waking; - struct task_struct *owner; - long owner_depth; - struct wait_queue * wait; + atomic_t waking; /* biased by -1 */ + struct wait_queue *wait; }; #define MUTEX ((struct semaphore) \ - { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL, 0, NULL }) + { ATOMIC_INIT(1), ATOMIC_INIT(-1), NULL }) #define MUTEX_LOCKED ((struct semaphore) \ - { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL, 1, NULL }) + { ATOMIC_INIT(0), ATOMIC_INIT(-1), NULL }) -#define semaphore_owner(sem) ((sem)->owner) #define sema_init(sem, val) atomic_set(&((sem)->count), val) extern void __down(struct semaphore * sem); extern int __down_interruptible(struct semaphore * sem); +extern int __down_trylock(struct semaphore * sem); extern void __up(struct semaphore * sem); -/* All three have custom assembly linkages. */ +/* All have custom assembly linkages. */ extern void __down_failed(struct semaphore * sem); extern void __down_failed_interruptible(struct semaphore * sem); +extern void __down_failed_trylock(struct semaphore * sem); extern void __up_wakeup(struct semaphore * sem); - -/* - * These two _must_ execute atomically wrt each other. - * - * This is trivially done with load_locked/store_cond, - * which we have. Let the rest of the losers suck eggs. - * - * Tricky bits -- - * - * (1) One task does two downs, no other contention - * initial state: - * count = 1, waking = 0, depth = undef; - * down(&sem) - * count = 0, waking = 0, depth = 1; - * down(&sem) - * atomic dec and test sends us to waking_non_zero via __down - * count = -1, waking = 0; - * conditional atomic dec on waking discovers no free slots - * count = -1, waking = 0; - * test for owner succeeeds and we return ok. - * count = -1, waking = 0, depth = 2; - * up(&sem) - * dec depth - * count = -1, waking = 0, depth = 1; - * atomic inc and test sends us to slow path - * count = 0, waking = 0, depth = 1; - * notice !(depth < 0) and don't call __up. - * up(&sem) - * dec depth - * count = 0, waking = 0, depth = 0; - * atomic inc and test succeeds. - * count = 1, waking = 0, depth = 0; - */ - -static inline void wake_one_more(struct semaphore * sem) -{ - atomic_inc(&sem->waking); -} - -static inline int waking_non_zero(struct semaphore *sem, - struct task_struct *tsk) -{ - long owner_depth; - int ret, tmp; - - owner_depth = sem->owner_depth; - - /* Atomic decrement, iff the value is > 0. */ - __asm__ __volatile__( - "1: ldl_l %1,%2\n" - " ble %1,2f\n" - " subl %1,1,%0\n" - " stl_c %0,%2\n" - " beq %0,3f\n" - "2: mb\n" - ".section .text2,\"ax\"\n" - "3: br 1b\n" - ".previous" - : "=r"(ret), "=r"(tmp), "=m"(__atomic_fool_gcc(&sem->waking)) - : "0"(0)); - - ret |= ((owner_depth != 0) & (sem->owner == tsk)); - if (ret) { - sem->owner = tsk; - wmb(); - /* Don't use the old value, which is stale in the - !owner case. */ - sem->owner_depth++; - } - - return ret; -} - /* * Whee. Hidden out of line code is fun. The contention cases are * handled out of line in kernel/sched.c; arch/alpha/lib/semaphore.S @@ -138,30 +53,31 @@ extern inline void down(struct semaphore * sem) it's return address in $28. The pv is loaded as usual. The gp is clobbered (in the module case) as usual. */ + /* This little bit of silliness is to get the GP loaded for + a function that ordinarily wouldn't. Otherwise we could + have it done by the macro directly, which can be optimized + the linker. */ + register void *pv __asm__("$27") = __down_failed; + __asm__ __volatile__ ( "/* semaphore down operation */\n" - "1: ldl_l $27,%3\n" - " subl $27,1,$27\n" - " mov $27,$28\n" - " stl_c $28,%0\n" + "1: ldl_l $24,%1\n" + " subl $24,1,$24\n" + " mov $24,$28\n" + " stl_c $28,%1\n" " beq $28,2f\n" - " blt $27,3f\n" - /* Got the semaphore no contention. Set owner and depth. */ - " stq $8,%1\n" - " lda $28,1\n" - " wmb\n" - " stq $28,%2\n" + " blt $24,3f\n" "4: mb\n" ".section .text2,\"ax\"\n" "2: br 1b\n" - "3: lda $24,%3\n" - " jsr $28,__down_failed\n" + "3: lda $24,%1\n" + " jsr $28,($27),__down_failed\n" " ldgp $29,0($28)\n" " br 4b\n" ".previous" - : "=m"(sem->count), "=m"(sem->owner), "=m"(sem->owner_depth) - : "m"(sem->count) - : "$24", "$27", "$28", "memory"); + : "=r"(pv) + : "m"(sem->count), "r"(pv) + : "$24", "$28", "memory"); } extern inline int down_interruptible(struct semaphore * sem) @@ -172,33 +88,83 @@ extern inline int down_interruptible(struct semaphore * sem) value is in $24. */ register int ret __asm__("$24"); + register void *pv __asm__("$27") = __down_failed_interruptible; __asm__ __volatile__ ( "/* semaphore down interruptible operation */\n" - "1: ldl_l $27,%4\n" - " subl $27,1,$27\n" - " mov $27,$28\n" - " stl_c $28,%1\n" + "1: ldl_l $24,%2\n" + " subl $24,1,$24\n" + " mov $24,$28\n" + " stl_c $28,%2\n" " beq $28,2f\n" - " blt $27,3f\n" - /* Got the semaphore no contention. Set owner and depth. */ - " stq $8,%2\n" - " lda $28,1\n" - " wmb\n" - " stq $28,%3\n" - " mov $31,$24\n" + " blt $24,3f\n" + " mov $31,%0\n" "4: mb\n" ".section .text2,\"ax\"\n" "2: br 1b\n" - "3: lda $24,%4\n" - " jsr $28,__down_failed_interruptible\n" + "3: lda $24,%2\n" + " jsr $28,($27),__down_failed_interruptible\n" " ldgp $29,0($28)\n" " br 4b\n" ".previous" - : "=r"(ret), "=m"(sem->count), "=m"(sem->owner), - "=m"(sem->owner_depth) - : "m"(sem->count) - : "$27", "$28", "memory"); + : "=r"(ret), "=r"(pv) + : "m"(sem->count), "r"(pv) + : "$28", "memory"); + + return ret; +} + +/* + * down_trylock returns 0 on success, 1 if we failed to get the lock. + * + * We must manipulate count and waking simultaneously and atomically. + * Do this by using ll/sc on the pair of 32-bit words. + */ + +extern inline int down_trylock(struct semaphore * sem) +{ + long ret, tmp, tmp2, sub; + + /* "Equivalent" C. Note that we have to do this all without + (taken) branches in order to be a valid ll/sc sequence. + + do { + tmp = ldq_l; + sub = 0x0000000100000000; + ret = ((int)tmp <= 0); // count =< 0 ? + if ((int)tmp >= 0) sub = 0; // count >= 0 ? + // note that if count=0 subq overflows to the high + // longword (i.e waking) + ret &= ((long)tmp < 0); // waking < 0 ? + sub += 1; + if (ret) + break; + tmp -= sub; + tmp = stq_c = tmp; + } while (tmp == 0); + */ + + __asm__ __volatile__( + "1: ldq_l %1,%4\n" + " lda %3,1\n" + " addl %1,0,%2\n" + " sll %3,32,%3\n" + " cmple %2,0,%0\n" + " cmovge %2,0,%3\n" + " cmplt %1,0,%2\n" + " addq %3,1,%3\n" + " and %0,%2,%0\n" + " bne %0,2f\n" + " subq %1,%3,%1\n" + " stq_c %1,%4\n" + " beq %1,3f\n" + "2:\n" + ".section .text2,\"ax\"\n" + "3: br 1b\n" + ".previous" + : "=&r"(ret), "=&r"(tmp), "=&r"(tmp2), "=&r"(sub) + : "m"(*sem) + : "memory"); return ret; } @@ -213,28 +179,29 @@ extern inline void up(struct semaphore * sem) it's return address in $28. The pv is loaded as usual. The gp is clobbered (in the module case) as usual. */ + register void *pv __asm__("$27") = __up_wakeup; + __asm__ __volatile__ ( "/* semaphore up operation */\n" " mb\n" - "1: ldl_l $27,%1\n" - " addl $27,1,$27\n" - " mov $27,$28\n" - " stl_c $28,%0\n" + "1: ldl_l $24,%1\n" + " addl $24,1,$24\n" + " mov $24,$28\n" + " stl_c $28,%1\n" " beq $28,2f\n" " mb\n" - " ble $27,3f\n" + " ble $24,3f\n" "4:\n" ".section .text2,\"ax\"\n" "2: br 1b\n" "3: lda $24,%1\n" - " bgt %2,4b\n" - " jsr $28,__up_wakeup\n" + " jsr $28,($27),__up_wakeup\n" " ldgp $29,0($28)\n" " br 4b\n" ".previous" - : "=m"(sem->count) - : "m"(sem->count), "r"(--sem->owner_depth) - : "$24", "$27", "$28", "memory"); + : "=r"(pv) + : "m"(sem->count), "r"(pv) + : "$24", "$28", "memory"); } #endif diff --git a/include/asm-alpha/siginfo.h b/include/asm-alpha/siginfo.h index f9f3e040a..a8bedd8e0 100644 --- a/include/asm-alpha/siginfo.h +++ b/include/asm-alpha/siginfo.h @@ -138,7 +138,7 @@ typedef struct siginfo { */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ -#define NSIGTRAP +#define NSIGTRAP 2 /* * SIGCHLD si_codes diff --git a/include/asm-alpha/sysinfo.h b/include/asm-alpha/sysinfo.h index d43ce2af2..cdd66a643 100644 --- a/include/asm-alpha/sysinfo.h +++ b/include/asm-alpha/sysinfo.h @@ -11,6 +11,8 @@ #define GSI_UACPROC 8 #define GSI_IEEE_FP_CONTROL 45 #define GSI_IEEE_STATE_AT_SIGNAL 46 +#define GSI_PROC_TYPE 60 +#define GSI_GET_HWRPB 101 #define SSI_NVPAIRS 1 #define SSI_IEEE_FP_CONTROL 14 diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index 626495adf..b37be73b2 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -1,6 +1,7 @@ #ifndef __ALPHA_SYSTEM_H #define __ALPHA_SYSTEM_H +#include <linux/config.h> #include <asm/pal.h> #include <asm/page.h> @@ -97,12 +98,15 @@ extern void wripir(unsigned long); extern void halt(void) __attribute__((noreturn)); -#define switch_to(prev,next) do { \ - current = next; \ - alpha_switch_to((unsigned long) ¤t->tss - IDENT_ADDR); \ +#define switch_to(prev,next,last) \ +do { \ + unsigned long pcbb; \ + current = (next); \ + pcbb = virt_to_phys(¤t->tss); \ + (last) = alpha_switch_to(pcbb, (prev)); \ } while (0) -extern void alpha_switch_to(unsigned long pctxp); +extern struct task_struct* alpha_switch_to(unsigned long, struct task_struct*); #define mb() \ __asm__ __volatile__("mb": : :"memory") @@ -119,6 +123,34 @@ __asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory") #define draina() \ __asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory") +enum implver_enum { + IMPLVER_EV4, + IMPLVER_EV5, + IMPLVER_EV6 +}; + +#ifdef CONFIG_ALPHA_GENERIC +#define implver() \ +({ unsigned long __implver; \ + __asm__ ("implver %0" : "=r"(__implver)); \ + (enum implver_enum) __implver; }) +#else +/* Try to eliminate some dead code. */ +#ifdef CONFIG_ALPHA_EV4 +#define implver() IMPLVER_EV4 +#endif +#ifdef CONFIG_ALPHA_EV5 +#define implver() IMPLVER_EV5 +#endif +#ifdef CONFIG_ALPHA_EV6 +#define implver() IMPLVER_EV6 +#endif +#endif + +#define amask(mask) \ +({ unsigned long __amask, __input = (mask); \ + __asm__ ("amask %1,%0" : "=r"(__amask) : "rI"(__input)); \ + __amask; }) static inline unsigned long wrperfmon(unsigned long perf_fun, unsigned long arg) diff --git a/include/asm-alpha/termios.h b/include/asm-alpha/termios.h index 015e2debb..35e14b49b 100644 --- a/include/asm-alpha/termios.h +++ b/include/asm-alpha/termios.h @@ -79,6 +79,7 @@ struct termio { #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ #ifdef __KERNEL__ /* eof=^D eol=\0 eol2=\0 erase=del diff --git a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h index 665acc313..f615339f8 100644 --- a/include/asm-alpha/uaccess.h +++ b/include/asm-alpha/uaccess.h @@ -160,7 +160,7 @@ struct __large_struct { unsigned long buf[100]; }; : "=r"(__gu_val), "=r"(__gu_err) \ : "m"(__m(addr)), "1"(__gu_err)) -#ifdef __HAVE_CPU_BWX +#ifdef __alpha_bwx__ /* Those lucky bastards with ev56 and later CPUs can do byte/word moves. */ #define __get_user_16(addr) \ @@ -274,7 +274,7 @@ __asm__ __volatile__("1: stl %r2,%1\n" \ : "=r"(__pu_err) \ : "m"(__m(addr)), "rJ"(x), "0"(__pu_err)) -#ifdef __HAVE_CPU_BWX +#ifdef __alpha_bwx__ /* Those lucky bastards with ev56 and later CPUs can do byte/word moves. */ #define __put_user_16(x,addr) \ @@ -358,43 +358,64 @@ __asm__ __volatile__("1: stb %r2,%1\n" \ * Complex access routines */ -#define __copy_to_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) -#define __copy_from_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) +extern void __copy_user(void); -#define copy_to_user(to,from,n) __copy_tofrom_user((to),(from),(n),__cu_to) -#define copy_from_user(to,from,n) __copy_tofrom_user((to),(from),(n),__cu_from) +extern inline long +__copy_tofrom_user_nocheck(void *to, const void *from, long len) +{ + /* This little bit of silliness is to get the GP loaded for + a function that ordinarily wouldn't. Otherwise we could + have it done by the macro directly, which can be optimized + the linker. */ + register void * pv __asm__("$27") = __copy_user; + + register void * __cu_to __asm__("$6") = to; + register const void * __cu_from __asm__("$7") = from; + register long __cu_len __asm__("$0") = len; + + __asm__ __volatile__( + "jsr $28,(%3),__copy_user\n\tldgp $29,0($28)" + : "=r" (__cu_len), "=r" (__cu_from), "=r" (__cu_to), "=r"(pv) + : "0" (__cu_len), "1" (__cu_from), "2" (__cu_to), "3"(pv) + : "$1","$2","$3","$4","$5","$28","memory"); + + return __cu_len; +} -extern void __copy_user(void); +extern inline long +__copy_tofrom_user(void *to, const void *from, long len, const void *validate) +{ + if (__access_ok((long)validate, len, get_fs())) { + register void * pv __asm__("$27") = __copy_user; + register void * __cu_to __asm__("$6") = to; + register const void * __cu_from __asm__("$7") = from; + register long __cu_len __asm__("$0") = len; + __asm__ __volatile__( + "jsr $28,(%3),__copy_user\n\tldgp $29,0($28)" + : "=r"(__cu_len), "=r"(__cu_from), "=r"(__cu_to), + "=r" (pv) + : "0" (__cu_len), "1" (__cu_from), "2" (__cu_to), + "3" (pv) + : "$1","$2","$3","$4","$5","$28","memory"); + len = __cu_len; + } + return len; +} -#define __copy_tofrom_user_nocheck(to,from,n) \ -({ \ - register void * __cu_to __asm__("$6") = (to); \ - register const void * __cu_from __asm__("$7") = (from); \ - register long __cu_len __asm__("$0") = (n); \ - __asm__ __volatile__( \ - "jsr $28,(%3),__copy_user" \ - : "=r" (__cu_len), "=r" (__cu_from), "=r" (__cu_to) \ - : "r" (__copy_user), "0" (__cu_len), \ - "1" (__cu_from), "2" (__cu_to) \ - : "$1","$2","$3","$4","$5","$28","memory"); \ - __cu_len; \ -}) +#define __copy_to_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) +#define __copy_from_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) -#define __copy_tofrom_user(to,from,n,v) \ -({ \ - register void * __cu_to __asm__("$6") = (to); \ - register const void * __cu_from __asm__("$7") = (from); \ - register long __cu_len __asm__("$0") = (n); \ - if (__access_ok(((long)(v)),__cu_len,get_fs())) { \ - __asm__ __volatile__( \ - "jsr $28,(%3),__copy_user" \ - : "=r" (__cu_len), "=r" (__cu_from), "=r" (__cu_to) \ - : "r" (__copy_user), "0" (__cu_len), \ - "1" (__cu_from), "2" (__cu_to) \ - : "$1","$2","$3","$4","$5","$28","memory"); \ - } \ - __cu_len; \ -}) +extern inline long +copy_to_user(void *to, const void *from, long n) +{ + return __copy_tofrom_user(to, from, n, to); +} + +extern inline long +copy_from_user(void *to, const void *from, long n) +{ + return __copy_tofrom_user(to, from, n, from); +} #define copy_to_user_ret(to,from,n,retval) ({ \ if (copy_to_user(to,from,n)) \ @@ -408,46 +429,55 @@ if (copy_from_user(to,from,n)) \ extern void __do_clear_user(void); -#define __clear_user(to,n) \ -({ \ - register void * __cl_to __asm__("$6") = (to); \ - register long __cl_len __asm__("$0") = (n); \ - __asm__ __volatile__( \ - "jsr $28,(%2),__do_clear_user" \ - : "=r"(__cl_len), "=r"(__cl_to) \ - : "r"(__do_clear_user), "0"(__cl_len), "1"(__cl_to) \ - : "$1","$2","$3","$4","$5","$28","memory"); \ - __cl_len; \ -}) +extern inline long +__clear_user(void *to, long len) +{ + /* This little bit of silliness is to get the GP loaded for + a function that ordinarily wouldn't. Otherwise we could + have it done by the macro directly, which can be optimized + the linker. */ + register void * pv __asm__("$27") = __do_clear_user; + + register void * __cl_to __asm__("$6") = to; + register long __cl_len __asm__("$0") = len; + __asm__ __volatile__( + "jsr $28,(%2),__do_clear_user\n\tldgp $29,0($28)" + : "=r"(__cl_len), "=r"(__cl_to), "=r"(pv) + : "0"(__cl_len), "1"(__cl_to), "2"(pv) + : "$1","$2","$3","$4","$5","$28","memory"); + return __cl_len; +} -#define clear_user(to,n) \ -({ \ - register void * __cl_to __asm__("$6") = (to); \ - register long __cl_len __asm__("$0") = (n); \ - if (__access_ok(((long)__cl_to),__cl_len,get_fs())) { \ - __asm__ __volatile__( \ - "jsr $28,(%2),__do_clear_user" \ - : "=r"(__cl_len), "=r"(__cl_to) \ - : "r"(__do_clear_user), "0"(__cl_len), "1"(__cl_to)\ - : "$1","$2","$3","$4","$5","$28","memory"); \ - } \ - __cl_len; \ -}) +extern inline long +clear_user(void *to, long len) +{ + if (__access_ok((long)to, len, get_fs())) { + register void * pv __asm__("$27") = __do_clear_user; + register void * __cl_to __asm__("$6") = to; + register long __cl_len __asm__("$0") = len; + __asm__ __volatile__( + "jsr $28,(%2),__do_clear_user\n\tldgp $29,0($28)" + : "=r"(__cl_len), "=r"(__cl_to), "=r"(pv) + : "0"(__cl_len), "1"(__cl_to), "2"(pv) + : "$1","$2","$3","$4","$5","$28","memory"); + len = __cl_len; + } + return len; +} /* Returns: -EFAULT if exception before terminator, N if the entire buffer filled, else strlen. */ extern long __strncpy_from_user(char *__to, const char *__from, long __to_len); -#define strncpy_from_user(to,from,n) \ -({ \ - char * __sfu_to = (to); \ - const char * __sfu_from = (from); \ - long __sfu_ret = -EFAULT; \ - if (__access_ok(((long)__sfu_from),0,get_fs())) \ - __sfu_ret = __strncpy_from_user(__sfu_to,__sfu_from,(n)); \ - __sfu_ret; \ -}) +extern inline long +strncpy_from_user(char *to, const char *from, long n) +{ + long ret = -EFAULT; + if (__access_ok((long)from, 0, get_fs())) + ret = __strncpy_from_user(to, from, n); + return ret; +} /* Returns: 0 if bad, string length+1 (memory size) of string if ok */ extern long __strlen_user(const char *); diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h index 733fe41c7..7e66f50d3 100644 --- a/include/asm-alpha/vga.h +++ b/include/asm-alpha/vga.h @@ -21,7 +21,7 @@ extern inline void scr_writew(u16 val, u16 *addr) writew(val, (unsigned long) addr); } -extern inline u16 scr_readw(u16 *addr) +extern inline u16 scr_readw(const u16 *addr) { if ((long) addr < 0) return *addr; @@ -37,12 +37,12 @@ extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count) memsetw_io(s, c, count); } -extern inline void scr_memcpyw_from(u16 *d, u16 *s, unsigned int count) +extern inline void scr_memcpyw_from(u16 *d, const u16 *s, unsigned int count) { memcpy_fromio(d, s, count); } -extern inline void scr_memcpyw_to(u16 *d, u16 *s, unsigned int count) +extern inline void scr_memcpyw_to(u16 *d, const u16 *s, unsigned int count) { memcpy_toio(d, s, count); } diff --git a/include/asm-arm/a.out.h b/include/asm-arm/a.out.h index 489d76eb5..ae967b0a6 100644 --- a/include/asm-arm/a.out.h +++ b/include/asm-arm/a.out.h @@ -26,7 +26,9 @@ struct exec #define M_ARM 103 +#ifdef __KERNEL__ #include <asm/arch/a.out.h> +#endif #ifndef LIBRARY_START_TEXT #define LIBRARY_START_TEXT (0x00c00000) diff --git a/include/asm-arm/arch-arc/a.out.h b/include/asm-arm/arch-arc/a.out.h index e00511463..0c13102d0 100644 --- a/include/asm-arm/arch-arc/a.out.h +++ b/include/asm-arm/arch-arc/a.out.h @@ -1,16 +1,14 @@ /* * linux/include/asm-arm/arch-arc/a.out.h * - * Copyright (C) 1996 Russell King - * - * Acorn Archimedes/A5000 a.out.h specs + * Copyright (C) 1996-1999 Russell King */ #ifndef __ASM_ARCH_A_OUT_H #define __ASM_ARCH_A_OUT_H -#ifdef __KERNEL__ -#define STACK_TOP (0x01a00000) -#endif +#include <asm/arch/memory.h> + +#define STACK_TOP TASK_SIZE #endif diff --git a/include/asm-arm/arch-arc/hardware.h b/include/asm-arm/arch-arc/hardware.h index c59007f3c..33b4659f8 100644 --- a/include/asm-arm/arch-arc/hardware.h +++ b/include/asm-arm/arch-arc/hardware.h @@ -1,7 +1,7 @@ /* * linux/include/asm-arm/arch-arc/hardware.h * - * Copyright (C) 1996 Russell King. + * Copyright (C) 1996-1999 Russell King. * * This file contains the hardware definitions of the * Acorn Archimedes/A5000 machines. @@ -9,21 +9,20 @@ * Modifications: * 04-04-1998 PJB/RMK Merged arc and a5k versions */ - #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H #include <linux/config.h> +#include <asm/arch/memory.h> + /* * What hardware must be present - these can be tested by the kernel * source. */ #define HAS_IOC -#include <asm/ioc.h> #define HAS_MEMC #include <asm/memc.h> -#define HAS_MEMC1A #define HAS_VIDC /* @@ -56,6 +55,12 @@ * for use with inb/outb */ #define IO_VIDC_BASE 0x80100000 +#ifdef CONFIG_ARCH_A5K +#define IOEB_VID_CTL 0x800d4012 +#define IOEB_PRESENT 0x800d4014 +#define IOEB_PSCLR 0x800d4016 +#define IOEB_MONTYPE 0x800d401c +#endif #ifdef CONFIG_ARCH_ARC #define LATCHAADDR 0x80094010 #define LATCHBADDR 0x80094006 @@ -66,6 +71,14 @@ #define IO_EC_IOC_BASE 0x80090000 #define IO_EC_MEMC_BASE 0x80000000 +#ifdef CONFIG_ARCH_ARC +/* A680 hardware */ +#define WD1973_BASE 0x03290000 +#define WD1973_LATCH 0x03350000 +#define Z8530_BASE 0x032b0008 +#define SCSI_BASE 0x03100000 +#endif + /* * IO definitions */ @@ -77,11 +90,8 @@ /* * RAM definitions */ -#define MAPTOPHYS(a) (((unsigned long)a & 0x007fffff) + PAGE_OFFSET) -#define KERNTOPHYS(a) ((((unsigned long)(&a)) & 0x007fffff) + PAGE_OFFSET) #define GET_MEMORY_END(p) (PAGE_OFFSET + (p->u1.s.page_size) * (p->u1.s.nr_pages)) #define PARAMS_BASE (PAGE_OFFSET + 0x7c000) -#define KERNEL_BASE (PAGE_OFFSET + 0x80000) #else diff --git a/include/asm-arm/arch-arc/irq.h b/include/asm-arm/arch-arc/irq.h index 0faabaf4d..97d3722bd 100644 --- a/include/asm-arm/arch-arc/irq.h +++ b/include/asm-arm/arch-arc/irq.h @@ -10,6 +10,9 @@ * 11-01-1998 RMK Added mask_and_ack_irq * 22-08-1998 RMK Restructured IRQ routines */ +#include <asm/ioc.h> + +#define fixup_irq(x) (x) static void arc_mask_irq_ack_a(unsigned int irq) { @@ -108,10 +111,17 @@ static __inline__ void irq_init_irq(void) outb(0, IOC_FIQMASK); for (irq = 0; irq < NR_IRQS; irq++) { - switch (irq & 0xf8) { + switch (irq) { case 0 ... 6: irq_desc[irq].probe_ok = 1; + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = arc_mask_irq_ack_a; + irq_desc[irq].mask = arc_mask_irq_a; + irq_desc[irq].unmask = arc_unmask_irq_a; + break; + case 7: + irq_desc[irq].noautoenable = 1; irq_desc[irq].valid = 1; irq_desc[irq].mask_ack = arc_mask_irq_ack_a; irq_desc[irq].mask = arc_mask_irq_a; diff --git a/include/asm-arm/arch-arc/keyboard.h b/include/asm-arm/arch-arc/keyboard.h index 388014703..1f57b9757 100644 --- a/include/asm-arm/arch-arc/keyboard.h +++ b/include/asm-arm/arch-arc/keyboard.h @@ -11,7 +11,6 @@ #define NR_SCANCODES 128 -extern int a5kkbd_translate(unsigned char scancode, unsigned char *keycode_p, char *up_flag_p); extern void a5kkbd_leds(unsigned char leds); extern void a5kkbd_init_hw(void); extern unsigned char a5kkbd_sysrq_xlate[NR_SCANCODES]; @@ -19,16 +18,7 @@ extern unsigned char a5kkbd_sysrq_xlate[NR_SCANCODES]; #define kbd_setkeycode(sc,kc) (-EINVAL) #define kbd_getkeycode(sc) (-EINVAL) -/* Prototype: int kbd_pretranslate(scancode, raw_mode) - * Returns : 0 to ignore scancode - */ -#define kbd_pretranslate(sc,rm) (1) - -/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) - * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag - * set to 0200 if scancode indicates release - */ -#define kbd_translate(sc, kcp, ufp, rm) a5kkbd_translate(sc, kcp, ufp) +#define kbd_translate(sc, kcp, rm) ({ *(kcp) = (sc); 1; }) #define kbd_unexpected_up(kc) (0200) #define kbd_leds(leds) a5kkbd_leds(leds) #define kbd_init_hw() a5kkbd_init_hw() diff --git a/include/asm-arm/arch-arc/mmu.h b/include/asm-arm/arch-arc/memory.h index 1e54d9863..8741f6222 100644 --- a/include/asm-arm/arch-arc/mmu.h +++ b/include/asm-arm/arch-arc/memory.h @@ -1,13 +1,25 @@ /* - * linux/include/asm-arm/arch-arc/mmu.h + * linux/include/asm-arm/arch-arc/memory.h * - * Copyright (c) 1996 Russell King. + * Copyright (c) 1996-1999 Russell King. * * Changelog: - * 22-11-1996 RMK Created + * 22-Nov-1996 RMK Created + * 21-Mar-1999 RMK Renamed to memory.h + * RMK Moved PAGE_OFFSET and TASK_SIZE here */ -#ifndef __ASM_ARCH_MMU_H -#define __ASM_ARCH_MMU_H +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* + * User space: 26MB + */ +#define TASK_SIZE (0x01a00000UL) + +/* + * Page offset: 32MB + */ +#define PAGE_OFFSET (0x02000000UL) #define __virt_to_phys__is_a_macro #define __virt_to_phys(vpage) vpage diff --git a/include/asm-arm/arch-arc/oldlatches.h b/include/asm-arm/arch-arc/oldlatches.h index 3252e1109..42f4c22f4 100644 --- a/include/asm-arm/arch-arc/oldlatches.h +++ b/include/asm-arm/arch-arc/oldlatches.h @@ -34,6 +34,8 @@ void oldlatch_bupdate(unsigned char mask,unsigned char newdata); /* newval=(oldval & mask)|newdata */ void oldlatch_aupdate(unsigned char mask,unsigned char newdata); +void oldlatch_init(void); + #elif defined(CONFIG_ARCH_A5K) #ifdef __need_oldlatches diff --git a/include/asm-arm/arch-arc/processor.h b/include/asm-arm/arch-arc/processor.h index cb63936e4..acc587961 100644 --- a/include/asm-arm/arch-arc/processor.h +++ b/include/asm-arm/arch-arc/processor.h @@ -1,15 +1,18 @@ /* * linux/include/asm-arm/arch-arc/processor.h * - * Copyright (c) 1996 Russell King. + * Copyright (c) 1996-1999 Russell King. * * Changelog: - * 10-09-1996 RMK Created + * 10-Sep-1996 RMK Created + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H #define __ASM_ARCH_PROCESSOR_H +#include <asm/arch/memory.h> + /* * Bus types */ @@ -18,17 +21,9 @@ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ -/* - * User space: 26MB - */ -#define TASK_SIZE (0x01a00000UL) - /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#define INIT_MMAP \ -{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } - #endif diff --git a/include/asm-arm/arch-arc/time.h b/include/asm-arm/arch-arc/time.h index 6df347484..c02ac8df5 100644 --- a/include/asm-arm/arch-arc/time.h +++ b/include/asm-arm/arch-arc/time.h @@ -8,6 +8,9 @@ * 10-Oct-1996 RMK Brought up to date with arch-sa110eval * 04-Dec-1997 RMK Updated for new arch/arm/time.c */ +#include <asm/ioc.h> + +static long last_rtc_update = 0; /* last time the cmos clock got updated */ extern __inline__ unsigned long gettimeoffset (void) { @@ -51,46 +54,140 @@ extern __inline__ unsigned long gettimeoffset (void) return offset; } -/* - * No need to reset the timer at every irq - */ -#define reset_timer() 1 +extern int iic_control (unsigned char, int, char *, int); -/* - * Updating of the RTC. We don't currently write the time to the - * CMOS clock. - */ -#define update_rtc() +static int set_rtc_time(unsigned long nowtime) +{ + char buf[5], ctrl; + + if (iic_control(0xa1, 0, &ctrl, 1) != 0) + printk("RTC: failed to read control reg\n"); + + /* + * Reset divider + */ + ctrl |= 0x80; + + if (iic_control(0xa0, 0, &ctrl, 1) != 0) + printk("RTC: failed to stop the clock\n"); + + /* + * We only set the time - we don't set the date. + * This means that there is the possibility once + * a day for the correction to disrupt the date. + * We really ought to write the time and date, or + * nothing at all. + */ + buf[0] = 0; + buf[1] = nowtime % 60; nowtime /= 60; + buf[2] = nowtime % 60; nowtime /= 60; + buf[3] = nowtime % 24; + + BIN_TO_BCD(buf[1]); + BIN_TO_BCD(buf[2]); + BIN_TO_BCD(buf[3]); + + if (iic_control(0xa0, 1, buf, 4) != 0) + printk("RTC: Failed to set the time\n"); + + /* + * Re-enable divider + */ + ctrl &= ~0x80; + + if (iic_control(0xa0, 0, &ctrl, 1) != 0) + printk("RTC: failed to start the clock\n"); + + return 0; +} + +extern __inline__ unsigned long get_rtc_time(void) +{ + unsigned int year, i; + char buf[8]; + + /* + * The year is not part of the RTC counter + * registers, and is stored in RAM. This + * means that it will not be automatically + * updated. + */ + if (iic_control(0xa1, 0xc0, buf, 1) != 0) + printk("RTC: failed to read the year\n"); + + /* + * If the year is before 1970, then the year + * is actually 100 in advance. This gives us + * a year 2070 bug... + */ + year = 1900 + buf[0]; + if (year < 1970) + year += 100; + + /* + * Read the time and date in one go - this + * will ensure that we don't get any effects + * due to carry (the RTC latches the counters + * during a read). + */ + if (iic_control(0xa1, 2, buf, 5) != 0) { + printk("RTC: failed to read the time and date\n"); + memset(buf, 0, sizeof(buf)); + } + + /* + * The RTC combines years with date and weekday + * with month. We need to mask off this extra + * information before converting the date to + * binary. + */ + buf[4] &= 0x1f; + buf[3] &= 0x3f; + + for (i = 0; i < 5; i++) + BCD_TO_BIN(buf[i]); + + return mktime(year, buf[4], buf[3], buf[2], buf[1], buf[0]); +} + +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + do_timer(regs); + + /* If we have an externally synchronized linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 && + xtime.tv_sec > last_rtc_update + 660 && + xtime.tv_usec >= 50000 - (tick >> 1) && + xtime.tv_usec < 50000 + (tick >> 1)) { + if (set_rtc_time(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else + last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + } +} + +static struct irqaction timerirq = { + timer_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; /* * Set up timer interrupt, and return the current time in seconds. */ -extern __inline__ unsigned long setup_timer (void) +extern __inline__ void setup_timer(void) { - extern int iic_control (unsigned char, int, char *, int); - unsigned int year, mon, day, hour, min, sec; - char buf[8]; - outb(LATCH & 255, IOC_T0LTCHL); outb(LATCH >> 8, IOC_T0LTCHH); outb(0, IOC_T0GO); - iic_control (0xa0, 0xc0, buf, 1); - year = buf[0]; - if ((year += 1900) < 1970) - year += 100; + xtime.tv_sec = get_rtc_time(); - iic_control (0xa0, 2, buf, 5); - mon = buf[4] & 0x1f; - day = buf[3] & 0x3f; - hour = buf[2]; - min = buf[1]; - sec = buf[0]; - BCD_TO_BIN(mon); - BCD_TO_BIN(day); - BCD_TO_BIN(hour); - BCD_TO_BIN(min); - BCD_TO_BIN(sec); - - return mktime(year, mon, day, hour, min, sec); + setup_arm_irq(IRQ_TIMER, &timerirq); } diff --git a/include/asm-arm/arch-arc/uncompress.h b/include/asm-arm/arch-arc/uncompress.h index f8c274f86..d9b46f1af 100644 --- a/include/asm-arm/arch-arc/uncompress.h +++ b/include/asm-arm/arch-arc/uncompress.h @@ -5,8 +5,6 @@ */ #define VIDMEM ((char *)0x02000000) -#include "../arch/arm/drivers/char/font.h" - int video_num_columns, video_num_lines, video_size_row; int white, bytes_per_char_h; extern unsigned long con_charconvtable[256]; diff --git a/include/asm-arm/arch-ebsa110/a.out.h b/include/asm-arm/arch-ebsa110/a.out.h index 2746584c8..71fcffe8e 100644 --- a/include/asm-arm/arch-ebsa110/a.out.h +++ b/include/asm-arm/arch-ebsa110/a.out.h @@ -1,15 +1,16 @@ /* * linux/include/asm-arm/arch-ebsa110/a.out.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996-1999 Russell King */ - #ifndef __ASM_ARCH_A_OUT_H #define __ASM_ARCH_A_OUT_H -#ifdef __KERNEL__ -#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#endif +#include <asm/arch/memory.h> + +#define STACK_TOP \ + ((current->personality == PER_LINUX_32BIT) ? \ + TASK_SIZE : 0x04000000) #endif diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h index e502b0fc6..5cad83502 100644 --- a/include/asm-arm/arch-ebsa110/hardware.h +++ b/include/asm-arm/arch-ebsa110/hardware.h @@ -1,19 +1,13 @@ /* * linux/include/asm-arm/arch-ebsa110/hardware.h * - * Copyright (C) 1996,1997,1998 Russell King. + * Copyright (C) 1996-1999 Russell King. * * This file contains the hardware definitions of the EBSA-110. */ - #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H -/* - * What hardware must be present - */ -#define HAS_PCIO - #ifndef __ASSEMBLER__ /* @@ -23,28 +17,28 @@ #define PIT_T2 ((volatile unsigned char *)0xf2000009) #define PIT_T1 ((volatile unsigned char *)0xf2000005) #define PIT_T0 ((volatile unsigned char *)0xf2000001) -#define PCIO_BASE 0xf0000000 /* * Mapping areas */ #define IO_BASE 0xe0000000 -#define IO_SIZE 0x20000000 -#define IO_START 0xe0000000 /* * RAM definitions */ -#define MAPTOPHYS(a) ((unsigned long)(a) - PAGE_OFFSET) -#define KERNTOPHYS(a) ((unsigned long)(&a)) -#define KERNEL_BASE (0xc0008000) #define FLUSH_BASE_PHYS 0x40000000 #else -#define PCIO_BASE 0xf0000000 #define IO_BASE 0 #endif + +#define IO_SIZE 0x20000000 +#define IO_START 0xe0000000 + +#define FLUSH_BASE 0xdf000000 +#define PCIO_BASE 0xf0000000 + #endif diff --git a/include/asm-arm/arch-ebsa110/irq.h b/include/asm-arm/arch-ebsa110/irq.h index 2f8b804d5..d26e93c76 100644 --- a/include/asm-arm/arch-ebsa110/irq.h +++ b/include/asm-arm/arch-ebsa110/irq.h @@ -11,6 +11,8 @@ #define IRQ_MSET ((volatile unsigned char *)0xf2c00000) #define IRQ_MASK ((volatile unsigned char *)0xf2c00000) +#define fixup_irq(x) (x) + static void ebsa110_mask_and_ack_irq(unsigned int irq) { *IRQ_MCLR = 1 << irq; diff --git a/include/asm-arm/arch-ebsa110/memory.h b/include/asm-arm/arch-ebsa110/memory.h new file mode 100644 index 000000000..67fa3a917 --- /dev/null +++ b/include/asm-arm/arch-ebsa110/memory.h @@ -0,0 +1,35 @@ +/* + * linux/include/asm-arm/arch-ebsa110/memory.h + * + * Copyright (c) 1996-1999 Russell King. + * + * Changelog: + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings + * 21-Mar-1999 RMK Renamed to memory.h + * RMK Moved TASK_SIZE and PAGE_OFFSET here + */ +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) + +/* + * Page offset: 3GB + */ +#define PAGE_OFFSET (0xc0000000UL) + +#define __virt_to_phys__is_a_macro +#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET) +#define __phys_to_virt__is_a_macro +#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET) + +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + +#endif diff --git a/include/asm-arm/arch-ebsa110/mm-init.h b/include/asm-arm/arch-ebsa110/mm-init.h deleted file mode 100644 index c6937abd0..000000000 --- a/include/asm-arm/arch-ebsa110/mm-init.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/mmap.h - * - * Copyright (C) 1996,1997,1998 Russell King - */ diff --git a/include/asm-arm/arch-ebsa110/mmu.h b/include/asm-arm/arch-ebsa110/mmu.h deleted file mode 100644 index 97776045d..000000000 --- a/include/asm-arm/arch-ebsa110/mmu.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/mmu.h - * - * Copyright (c) 1996,1997,1998 Russell King. - * - * Changelog: - * 20-10-1996 RMK Created - * 31-12-1997 RMK Fixed definitions to reduce warnings - */ -#ifndef __ASM_ARCH_MMU_H -#define __ASM_ARCH_MMU_H - -#define __virt_to_phys__is_a_macro -#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET) -#define __phys_to_virt__is_a_macro -#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET) - -#define __virt_to_bus__is_a_macro -#define __virt_to_bus(x) __virt_to_phys(x) -#define __bus_to_virt__is_a_macro -#define __bus_to_virt(x) __phys_to_virt(x) - -#endif diff --git a/include/asm-arm/arch-ebsa110/oldlatches.h b/include/asm-arm/arch-ebsa110/oldlatches.h deleted file mode 100644 index 8ff6ebd67..000000000 --- a/include/asm-arm/arch-ebsa110/oldlatches.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Dummy oldlatches.h - * - * Copyright (C) 1996 Russell King - */ - -#ifdef __need_oldlatches -#error "Old latches not present in this (rpc) machine" -#endif diff --git a/include/asm-arm/arch-ebsa110/processor.h b/include/asm-arm/arch-ebsa110/processor.h index e98d1ff33..bd99869af 100644 --- a/include/asm-arm/arch-ebsa110/processor.h +++ b/include/asm-arm/arch-ebsa110/processor.h @@ -1,12 +1,17 @@ /* * linux/include/asm-arm/arch-ebsa110/processor.h * - * Copyright (C) 1996,1997,1998 Russell King + * Copyright (C) 1996-1999 Russell King + * + * Changelog: + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H #define __ASM_ARCH_PROCESSOR_H +#include <asm/arch/memory.h> + /* * Bus types */ @@ -15,17 +20,9 @@ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ -/* - * User space: 3GB - */ -#define TASK_SIZE (0xc0000000UL) - /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#define INIT_MMAP \ -{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } - #endif diff --git a/include/asm-arm/arch-ebsa110/time.h b/include/asm-arm/arch-ebsa110/time.h index 1f21a02e6..21728e469 100644 --- a/include/asm-arm/arch-ebsa110/time.h +++ b/include/asm-arm/arch-ebsa110/time.h @@ -38,63 +38,67 @@ extern __inline__ unsigned long gettimeoffset (void) return 0; } -#ifndef DIVISOR -extern __inline__ int reset_timer (void) +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { *PIT_T1 = (PIT1_COUNT) & 0xff; *PIT_T1 = (PIT1_COUNT) >> 8; - return 1; -} -#else -extern __inline__ int reset_timer (void) -{ - static unsigned int divisor; -#ifdef CONFIG_LEDS - static int count = 50; -#endif - - *PIT_T1 = (PIT1_COUNT) & 0xff; - *PIT_T1 = (PIT1_COUNT) >> 8; #ifdef CONFIG_LEDS - if (--count == 0) { - count = 50; - leds_event(led_timer); + { + static int count = 50; + if (--count == 0) { + count = 50; + leds_event(led_timer); + } } #endif - if (divisor == 0) { - divisor = DIVISOR - 1; - return 1; + { +#ifdef DIVISOR + static unsigned int divisor; + + if (divisor-- == 0) { + divisor = DIVISOR - 1; +#else + { +#endif + do_timer(regs); + } } - divisor -= 1; - return 0; } -#endif -/* - * We don't have a RTC to update! - */ -#define update_rtc() +static struct irqaction timerirq = { + timer_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; /* * Set up timer interrupt, and return the current time in seconds. */ -extern __inline__ unsigned long setup_timer (void) +extern __inline__ void setup_timer(void) { /* * Timer 1, mode 0, 16-bit, autoreload */ *PIT_CTRL = 0x70; + /* * Refresh counter clocked at 47.8MHz/7 = 146.4ns * We want centi-second interrupts */ - reset_timer (); + *PIT_T1 = (PIT1_COUNT) & 0xff; + *PIT_T1 = (PIT1_COUNT) >> 8; + /* * Default the date to 1 Jan 1970 0:0:0 * You will have to run a time daemon to set the * clock correctly at bootup */ - return mktime(1970, 1, 1, 0, 0, 0); + xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0); + + setup_arm_irq(IRQ_TIMER, &timerirq); } diff --git a/include/asm-arm/arch-ebsa285/a.out.h b/include/asm-arm/arch-ebsa285/a.out.h index 2746584c8..71fcffe8e 100644 --- a/include/asm-arm/arch-ebsa285/a.out.h +++ b/include/asm-arm/arch-ebsa285/a.out.h @@ -1,15 +1,16 @@ /* * linux/include/asm-arm/arch-ebsa110/a.out.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996-1999 Russell King */ - #ifndef __ASM_ARCH_A_OUT_H #define __ASM_ARCH_A_OUT_H -#ifdef __KERNEL__ -#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#endif +#include <asm/arch/memory.h> + +#define STACK_TOP \ + ((current->personality == PER_LINUX_32BIT) ? \ + TASK_SIZE : 0x04000000) #endif diff --git a/include/asm-arm/arch-ebsa285/dma.h b/include/asm-arm/arch-ebsa285/dma.h index 28c093aec..8b74a7f84 100644 --- a/include/asm-arm/arch-ebsa285/dma.h +++ b/include/asm-arm/arch-ebsa285/dma.h @@ -3,8 +3,8 @@ * * Architecture DMA routines * - * Copyright (C) 1998 Russell King - * Copyright (C) 1998 Philip Blundell + * Copyright (C) 1998,1999 Russell King + * Copyright (C) 1998,1999 Philip Blundell */ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H @@ -15,12 +15,16 @@ #define MAX_DMA_ADDRESS 0xffffffff /* - * The 21285 has two internal DMA channels; we call these 0 and 1. + * The 21285 has two internal DMA channels; we call these 8 and 9. * On CATS hardware we have an additional eight ISA dma channels - * numbered 2..9. + * numbered 0..7. */ +#define _ISA_DMA(x) (0+(x)) +#define _DC21285_DMA(x) (8+(x)) + #define MAX_DMA_CHANNELS 10 -#define DMA_ISA_BASE 2 -#define DMA_FLOPPY (DMA_ISA_BASE + 2) + +#define DMA_FLOPPY _ISA_DMA(2) +#define DMA_ISA_CASCADE _ISA_DMA(4) #endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h index e08c5b823..c989e0f09 100644 --- a/include/asm-arm/arch-ebsa285/hardware.h +++ b/include/asm-arm/arch-ebsa285/hardware.h @@ -1,47 +1,135 @@ /* * linux/include/asm-arm/arch-ebsa285/hardware.h * - * Copyright (C) 1998 Russell King. + * Copyright (C) 1998-1999 Russell King. * * This file contains the hardware definitions of the EBSA-285. */ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H +#include <linux/config.h> +#include <asm/arch/memory.h> -/* Logical Physical +#ifdef CONFIG_HOST_FOOTBRIDGE +/* Virtual Physical * 0xfff00000 0x40000000 X-Bus - * 0xffe00000 0x7c000000 PCI I/O space + * 0xff000000 0x7c000000 PCI I/O space * * 0xfe000000 0x42000000 CSR * 0xfd000000 0x78000000 Outbound write flush * 0xfc000000 0x79000000 PCI IACK/special space * - * 0xf9000000 0x7a010000 PCI Config type 1 - * 0xf8000000 0x7b010000 PCI Config type 0 + * 0xf9000000 0x7a000000 PCI Config type 1 + * 0xf8000000 0x7b000000 PCI Config type 0 * */ +#define XBUS_SIZE 0x00100000 +#define XBUS_BASE 0xfff00000 -#include <asm/dec21285.h> - -#define IO_BASE 0xe0000000 -#define PCIO_BASE 0xffe00000 -#define PCI_IACK 0xfc000000 +#define PCIO_SIZE 0x00100000 +#define PCIO_BASE 0xff000000 -#define XBUS_LEDS ((volatile unsigned char *)0xfff12000) +#define ARMCSR_SIZE 0x01000000 +#define ARMCSR_BASE 0xfe000000 + +#define WFLUSH_SIZE 0x01000000 +#define WFLUSH_BASE 0xfd000000 + +#define PCIIACK_SIZE 0x01000000 +#define PCIIACK_BASE 0xfc000000 + +#define PCICFG1_SIZE 0x01000000 +#define PCICFG1_BASE 0xf9000000 + +#define PCICFG0_SIZE 0x01000000 +#define PCICFG0_BASE 0xf8000000 + +#define PCIMEM_SIZE 0x18000000 +#define PCIMEM_BASE 0xe0000000 + +#define FLUSH_SIZE 0x00100000 +#define FLUSH_BASE 0xdf000000 + +#define FLASH_SIZE 0x00400000 +#define FLASH_BASE 0xd8000000 + +#elif defined(CONFIG_ARCH_CO285) + +#define PCIMEM_SIZE 0x80000000 +#define PCIMEM_BASE 0x80000000 + +#define FLASH_SIZE 0x01000000 +#define FLASH_BASE 0x7f000000 + +#define FLUSH_SIZE 0x00100000 +#define FLUSH_BASE 0x7e000000 + +#define WFLUSH_SIZE 0x01000000 +#define WFLUSH_BASE 0x7d000000 + +#define ARMCSR_SIZE 0x00100000 +#define ARMCSR_BASE 0x7cf00000 + +#define XBUS_SIZE 0x00020000 +#define XBUS_BASE 0x7cee0000 + +#define PCIO_SIZE 0x00010000 +#define PCIO_BASE 0x7ced0000 + +#else + +#error Add your add-in architecture here + +#endif + +#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000)) #define XBUS_LED_AMBER (1 << 0) #define XBUS_LED_GREEN (1 << 1) #define XBUS_LED_RED (1 << 2) #define XBUS_LED_TOGGLE (1 << 8) -#define XBUS_SWITCH ((volatile unsigned char *)0xfff12000) +#define XBUS_SWITCH ((volatile unsigned char *)(XBUS_BASE + 0x12000)) #define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15) #define XBUS_SWITCH_J17_13 ((*XBUS_SWITCH) & (1 << 4)) #define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5)) #define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6)) -#define KERNTOPHYS(a) ((unsigned long)(&a)) - #define PARAMS_OFFSET 0x0100 #define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) #define FLUSH_BASE_PHYS 0x50000000 + +/* PIC irq control */ +#define PIC_LO 0x20 +#define PIC_MASK_LO 0x21 +#define PIC_HI 0xA0 +#define PIC_MASK_HI 0xA1 + +/* GPIO pins */ +#define GPIO_CCLK 0x800 +#define GPIO_DSCLK 0x400 +#define GPIO_E2CLK 0x200 +#define GPIO_IOLOAD 0x100 +#define GPIO_RED_LED 0x080 +#define GPIO_WDTIMER 0x040 +#define GPIO_DATA 0x020 +#define GPIO_IOCLK 0x010 +#define GPIO_DONE 0x008 +#define GPIO_FAN 0x004 +#define GPIO_GREEN_LED 0x002 +#define GPIO_RESET 0x001 + +/* CPLD pins */ +#define CPLD_DSRESET 8 +#define CPLD_UNMUTE 2 + +#ifndef __ASSEMBLY__ +extern void gpio_modify_op(int mask, int set); +extern void gpio_modify_io(int mask, int in); +extern int gpio_read(void); +extern void cpld_modify(int mask, int set); +#endif + +#endif diff --git a/include/asm-arm/arch-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h index 1be73879d..b23ee6863 100644 --- a/include/asm-arm/arch-ebsa285/io.h +++ b/include/asm-arm/arch-ebsa285/io.h @@ -16,34 +16,37 @@ * has the constant-optimised IO */ #undef ARCH_IO_DELAY +#define ARCH_READWRITE /* * Dynamic IO functions - let the compiler * optimize the expressions */ -#define DECLARE_DYN_OUT(fnsuffix,instr,typ) \ -extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ -{ \ - __asm__ __volatile__( \ - "str%?" ##instr## " %0, [%1, %2] @ out"###fnsuffix \ - : \ - : "r" (value), "r" (PCIO_BASE), typ (port)); \ +#define DECLARE_DYN_OUT(fnsuffix,instr,typ) \ +extern __inline__ void \ +__out##fnsuffix (unsigned int value, unsigned int port) \ +{ \ + __asm__ __volatile__( \ + "str%?" ##instr## " %0, [%1, %2] @ out"###fnsuffix \ + : \ + : "r" (value), "r" (PCIO_BASE), typ (port)); \ } -#define DECLARE_DYN_IN(sz,fnsuffix,instr,typ) \ -extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ -{ \ - unsigned long value; \ - __asm__ __volatile__( \ - "ldr%?" ##instr## " %0, [%1, %2] @ in"###fnsuffix \ - : "=&r" (value) \ - : "r" (PCIO_BASE), typ (port)); \ - return (unsigned sz)value; \ +#define DECLARE_DYN_IN(sz,fnsuffix,instr,typ) \ +extern __inline__ unsigned sz \ +__in##fnsuffix (unsigned int port) \ +{ \ + unsigned long value; \ + __asm__ __volatile__( \ + "ldr%?" ##instr## " %0, [%1, %2] @ in"###fnsuffix \ + : "=&r" (value) \ + : "r" (PCIO_BASE), typ (port)); \ + return (unsigned sz)value; \ } -extern __inline__ unsigned int __ioaddr (unsigned int port) \ -{ \ - return (unsigned int)(PCIO_BASE + port); \ +extern __inline__ unsigned int __ioaddr (unsigned int port) \ +{ \ + return (unsigned int)(PCIO_BASE + port); \ } #define DECLARE_IO(sz,fnsuffix,instr,typ) \ @@ -64,65 +67,65 @@ DECLARE_IO(long,l,"","Jr") * These have to be macros for the 'J' constraint to work - * +/-4096 immediate operand. */ -#define __outbc(value,port) \ -({ \ - __asm__ __volatile__( \ - "str%?b %0, [%1, %2] @ outbc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ +#define __outbc(value,port) \ +({ \ + __asm__ __volatile__( \ + "str%?b %0, [%1, %2] @ outbc" \ + : \ + : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ }) -#define __inbc(port) \ -({ \ - unsigned char result; \ - __asm__ __volatile__( \ - "ldr%?b %0, [%1, %2] @ inbc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "Jr" (port)); \ - result; \ +#define __inbc(port) \ +({ \ + unsigned char result; \ + __asm__ __volatile__( \ + "ldr%?b %0, [%1, %2] @ inbc" \ + : "=r" (result) \ + : "r" (PCIO_BASE), "Jr" (port)); \ + result; \ }) -#define __outwc(value,port) \ -({ \ - __asm__ __volatile__( \ - "str%?h %0, [%1, %2] @ outwc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "r" (port)); \ +#define __outwc(value,port) \ +({ \ + __asm__ __volatile__( \ + "str%?h %0, [%1, %2] @ outwc" \ + : \ + : "r" (value), "r" (PCIO_BASE), "r" (port)); \ }) -#define __inwc(port) \ -({ \ - unsigned short result; \ - __asm__ __volatile__( \ - "ldr%?h %0, [%1, %2] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "r" (port)); \ - result & 0xffff; \ +#define __inwc(port) \ +({ \ + unsigned short result; \ + __asm__ __volatile__( \ + "ldr%?h %0, [%1, %2] @ inwc" \ + : "=r" (result) \ + : "r" (PCIO_BASE), "r" (port)); \ + result & 0xffff; \ }) -#define __outlc(value,port) \ -({ \ - __asm__ __volatile__( \ - "str%? %0, [%1, %2] @ outlc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ +#define __outlc(value,port) \ +({ \ + __asm__ __volatile__( \ + "str%? %0, [%1, %2] @ outlc" \ + : \ + : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ }) -#define __inlc(port) \ -({ \ - unsigned long result; \ - __asm__ __volatile__( \ - "ldr%? %0, [%1, %2] @ inlc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "Jr" (port)); \ - result; \ +#define __inlc(port) \ +({ \ + unsigned long result; \ + __asm__ __volatile__( \ + "ldr%? %0, [%1, %2] @ inlc" \ + : "=r" (result) \ + : "r" (PCIO_BASE), "Jr" (port)); \ + result; \ }) -#define __ioaddrc(port) \ -({ \ - unsigned long addr; \ - addr = PCIO_BASE + port; \ - addr; \ +#define __ioaddrc(port) \ +({ \ + unsigned long addr; \ + addr = PCIO_BASE + port; \ + addr; \ }) /* @@ -130,20 +133,22 @@ DECLARE_IO(long,l,"","Jr") * * IO address has already been translated to a virtual address */ -#define outb_t(v,p) \ +#define outb_t(v,p) \ (*(volatile unsigned char *)(p) = (v)) -#define inb_t(p) \ +#define inb_t(p) \ (*(volatile unsigned char *)(p)) -#define outl_t(v,p) \ +#define outl_t(v,p) \ (*(volatile unsigned long *)(p) = (v)) -#define inl_t(p) \ +#define inl_t(p) \ (*(volatile unsigned long *)(p)) /* - * ioremap support + * ioremap support - validate a PCI memory address, + * and convert a PCI memory address to a physical + * address for the page tables. */ #define valid_ioaddr(iomem,size) ((iomem) < 0x80000000 && (iomem) + (size) <= 0x80000000) #define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM) @@ -153,58 +158,48 @@ DECLARE_IO(long,l,"","Jr") * is using read*() and so on with addresses they didn't get from ioremap * this can go away. */ -#define IO_FUDGE_FACTOR 0xe0000000 +#define IO_FUDGE_FACTOR PCIMEM_BASE -extern inline void *ioremap(unsigned long iomem_addr, unsigned long size) -{ - unsigned long phys_addr; - - if (!valid_ioaddr(iomem_addr, size)) - return NULL; - - phys_addr = io_to_phys(iomem_addr & PAGE_MASK); - - return (void *)((unsigned long)__ioremap(phys_addr, size, 0) - - IO_FUDGE_FACTOR); -} +/* + * ioremap takes a PCI memory address, as specified in + * linux/Documentation/IO-mapping.txt + */ +#define ioremap(iomem_addr,size) \ +({ \ + unsigned long _addr = (iomem_addr), _size = (size); \ + void *_ret = NULL; \ + if (valid_ioaddr(_addr, _size)) { \ + _addr = io_to_phys(_addr); \ + _ret = __ioremap(_addr, _size, 0) - IO_FUDGE_FACTOR; \ + } \ + _ret; }) #define ioremap_nocache(iomem_addr,size) ioremap((iomem_addr),(size)) extern void iounmap(void *addr); -/* - * We'd probably be better off with these as macros rather than functions. - * Firstly that would be more efficient and secondly we could do with the - * ability to stop GCC whinging about type conversions. --philb - */ -static inline void writeb(unsigned char b, unsigned int addr) -{ - *(volatile unsigned char *)(IO_FUDGE_FACTOR + (addr)) = b; -} - -static inline unsigned char readb(unsigned int addr) -{ - return *(volatile unsigned char *)(IO_FUDGE_FACTOR + (addr)); +#define DECLARE_PCI_WRITE(typ,fnsuffix) \ +static inline void write##fnsuffix(unsigned typ val, unsigned int addr) \ +{ \ + *(volatile unsigned typ *)(IO_FUDGE_FACTOR + addr) = val; \ } -static inline void writew(unsigned short b, unsigned int addr) -{ - *(volatile unsigned short *)(IO_FUDGE_FACTOR + (addr)) = b; +#define DECLARE_PCI_READ(typ,fnsuffix) \ +static inline unsigned typ read##fnsuffix (unsigned int addr) \ +{ \ + return *(volatile unsigned typ *)(IO_FUDGE_FACTOR + addr); \ } -static inline unsigned short readw(unsigned int addr) -{ - return *(volatile unsigned short *)(IO_FUDGE_FACTOR + (addr)); -} +#define DECLARE_PCI(typ,fnsuffix) \ + DECLARE_PCI_WRITE(typ,fnsuffix) \ + DECLARE_PCI_READ(typ,fnsuffix) -static inline void writel(unsigned long b, unsigned int addr) -{ - *(volatile unsigned long *)(IO_FUDGE_FACTOR + (addr)) = b; -} +DECLARE_PCI(char,b) +DECLARE_PCI(short,w) +DECLARE_PCI(long,l) -static inline unsigned short readl(unsigned int addr) -{ - return *(volatile unsigned long *)(IO_FUDGE_FACTOR + (addr)); -} +#undef DECLARE_PCI +#undef DECLARE_PCI_READ +#undef DECLARE_PCI_WRITE #endif diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index 74bc33c58..ca1a55cdb 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -4,136 +4,206 @@ * Copyright (C) 1996-1998 Russell King * * Changelog: - * 22-08-1998 RMK Restructured IRQ routines - * 03-09-1998 PJB Merged CATS support + * 22-Aug-1998 RMK Restructured IRQ routines + * 03-Sep-1998 PJB Merged CATS support + * 20-Jan-1998 RMK Started merge of EBSA286, CATS and NetWinder + * 26-Jan-1999 PJB Don't use IACK on CATS + * 16-Mar-1999 RMK Added autodetect of ISA PICs */ #include <linux/config.h> +#include <asm/hardware.h> +#include <asm/dec21285.h> +#include <asm/irq.h> -static void ebsa285_mask_irq(unsigned int irq) +/* + * Footbridge IRQ translation table + * Converts from our IRQ numbers into FootBridge masks + */ +static int dc21285_irq_mask[] = { + IRQ_MASK_UART_RX, /* 0 */ + IRQ_MASK_UART_TX, /* 1 */ + IRQ_MASK_TIMER1, /* 2 */ + IRQ_MASK_TIMER2, /* 3 */ + IRQ_MASK_TIMER3, /* 4 */ + IRQ_MASK_IN0, /* 5 */ + IRQ_MASK_IN1, /* 6 */ + IRQ_MASK_IN2, /* 7 */ + IRQ_MASK_IN3, /* 8 */ + IRQ_MASK_DOORBELLHOST, /* 9 */ + IRQ_MASK_DMA1, /* 10 */ + IRQ_MASK_DMA2, /* 11 */ + IRQ_MASK_PCI, /* 12 */ + IRQ_MASK_SDRAMPARITY, /* 13 */ + IRQ_MASK_I2OINPOST, /* 14 */ + IRQ_MASK_PCI_ERR /* 15 */ +}; + +static int isa_irq = -1; + +static inline int fixup_irq(unsigned int irq) { - *CSR_IRQ_DISABLE = 1 << irq; +#ifdef CONFIG_HOST_FOOTBRIDGE + if (irq == isa_irq) + irq = *(unsigned char *)PCIIACK_BASE; +#endif + + return irq; } -static void ebsa285_unmask_irq(unsigned int irq) +static void dc21285_mask_irq(unsigned int irq) { - *CSR_IRQ_ENABLE = 1 << irq; + *CSR_IRQ_DISABLE = dc21285_irq_mask[irq & 15]; } -#ifdef CONFIG_CATS +static void dc21285_unmask_irq(unsigned int irq) +{ + *CSR_IRQ_ENABLE = dc21285_irq_mask[irq & 15]; +} -/* - * This contains the irq mask for both 8259A irq controllers, - */ -static unsigned int isa_irq_mask = 0xffff; +static void isa_mask_pic_lo_irq(unsigned int irq) +{ + unsigned int mask = 1 << (irq & 7); + + outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); +} -#define cached_21 (isa_irq_mask & 0xff) -#define cached_A1 ((isa_irq_mask >> 8) & 0xff) +static void isa_mask_ack_pic_lo_irq(unsigned int irq) +{ + unsigned int mask = 1 << (irq & 7); -#define update_8259(_irq) \ - if ((_irq) & 8) \ - outb(cached_A1, 0xa1); \ - else \ - outb(cached_21, 0x21); + outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); + outb(0x20, PIC_LO); +} -static void isa_interrupt(int irq, void *h, struct pt_regs *regs) +static void isa_unmask_pic_lo_irq(unsigned int irq) { - asmlinkage void do_IRQ(int irq, struct pt_regs * regs); - unsigned int irqbits = inb(0x20) | (inb(0xa0) << 8), irqnr = 0; - irqbits &= ~(1<<2); /* don't try to service the cascade */ - while (irqbits) { - if (irqbits & 1) - do_IRQ(32 + irqnr, regs); - irqbits >>= 1; - irqnr++; - } + unsigned int mask = 1 << (irq & 7); + + outb(inb(PIC_MASK_LO) & ~mask, PIC_MASK_LO); } -static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { } +static void isa_mask_pic_hi_irq(unsigned int irq) +{ + unsigned int mask = 1 << (irq & 7); -static struct irqaction irq_isa = - { isa_interrupt, SA_INTERRUPT, 0, "ISA PIC", NULL, NULL }; -static struct irqaction irq_cascade = - { no_action, 0, 0, "cascade", NULL, NULL }; + outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); +} -static void cats_mask_and_ack_isa_irq(unsigned int irq) +static void isa_mask_ack_pic_hi_irq(unsigned int irq) { - isa_irq_mask |= (1 << (irq - 32)); - update_8259(irq); - if (irq & 8) { - inb(0xA1); /* DUMMY */ - outb(cached_A1,0xA1); - outb(0x62,0x20); /* Specific EOI to cascade */ - outb(0x20,0xA0); - } else { - inb(0x21); /* DUMMY */ - outb(cached_21,0x21); - outb(0x20,0x20); - } + unsigned int mask = 1 << (irq & 7); + + outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); + outb(0x62, PIC_LO); + outb(0x20, PIC_HI); } -static void cats_mask_isa_irq(unsigned int irq) +static void isa_unmask_pic_hi_irq(unsigned int irq) { - isa_irq_mask |= (1 << (irq - 32)); - update_8259(irq); + unsigned int mask = 1 << (irq & 7); + + outb(inb(PIC_MASK_HI) & ~mask, PIC_MASK_HI); } -static void cats_unmask_isa_irq(unsigned int irq) +static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { - isa_irq_mask &= ~(1 << (irq - 32)); - update_8259(irq); } - -#endif + +static struct irqaction irq_cascade = { no_action, 0, 0, "cascade", NULL, NULL }; static __inline__ void irq_init_irq(void) { int irq; + /* + * setup DC21285 IRQs + */ *CSR_IRQ_DISABLE = -1; *CSR_FIQ_DISABLE = -1; - for (irq = 0; irq < NR_IRQS; irq++) { + for (irq = _DC21285_IRQ(0); irq < _DC21285_IRQ(16); irq++) { irq_desc[irq].valid = 1; irq_desc[irq].probe_ok = 1; -#ifdef CONFIG_CATS - if (machine_is_cats() && IRQ_IS_ISA(irq)) { - irq_desc[irq].mask_ack = cats_mask_and_ack_isa_irq; - irq_desc[irq].mask = cats_mask_isa_irq; - irq_desc[irq].unmask = cats_unmask_isa_irq; + irq_desc[irq].mask_ack = dc21285_mask_irq; + irq_desc[irq].mask = dc21285_mask_irq; + irq_desc[irq].unmask = dc21285_unmask_irq; + } + + /* + * Determine the ISA settings for + * the machine we're running on. + */ + switch (machine_arch_type) { + default: + isa_irq = -1; + break; + + case MACH_TYPE_EBSA285: + /* The following is dependent on which slot + * you plug the Southbridge card into. We + * currently assume that you plug it into + * the right-hand most slot. + */ + isa_irq = IRQ_PCI; + break; + + case MACH_TYPE_CATS: + isa_irq = IRQ_IN2; + break; + + case MACH_TYPE_NETWINDER: + isa_irq = IRQ_IN3; + break; + } + + if (isa_irq != -1) { + /* + * Setup, and then probe for an ISA PIC + */ + outb(0x11, PIC_LO); + outb(_ISA_IRQ(0), PIC_MASK_LO); /* IRQ number */ + outb(0x04, PIC_MASK_LO); /* Slave on Ch2 */ + outb(0x01, PIC_MASK_LO); /* x86 */ + outb(0xf5, PIC_MASK_LO); /* pattern: 11110101 */ + + outb(0x11, PIC_HI); + outb(_ISA_IRQ(8), PIC_MASK_HI); /* IRQ number */ + outb(0x02, PIC_MASK_HI); /* Slave on Ch1 */ + outb(0x01, PIC_MASK_HI); /* x86 */ + outb(0xfa, PIC_MASK_HI); /* pattern: 11111010 */ + +// outb(0x68, PIC_LO); /* enable special mode */ +// outb(0x68, PIC_HI); /* enable special mode */ + outb(0x0b, PIC_LO); + outb(0x0b, PIC_HI); + + if (inb(PIC_MASK_LO) == 0xf5 && inb(PIC_MASK_HI) == 0xfa) { + outb(0xff, PIC_MASK_LO);/* mask all IRQs */ + outb(0xff, PIC_MASK_HI);/* mask all IRQs */ } else -#endif - { - irq_desc[irq].mask_ack = ebsa285_mask_irq; - irq_desc[irq].mask = ebsa285_mask_irq; - irq_desc[irq].unmask = ebsa285_unmask_irq; - } + isa_irq = -1; } -#ifdef CONFIG_CATS - if (machine_is_cats()) { - request_region(0x20, 2, "pic1"); - request_region(0xa0, 2, "pic2"); - - /* set up master 8259 */ - outb(0x11, 0x20); - outb(0, 0x21); - outb(1<<2, 0x21); - outb(0x1, 0x21); - outb(0xff, 0x21); - outb(0x68, 0x20); - outb(0xa, 0x20); - - /* set up slave 8259 */ - outb(0x11, 0xa0); - outb(0, 0xa1); - outb(2, 0xa1); - outb(0x1, 0xa1); - outb(0xff, 0xa1); - outb(0x68, 0xa0); - outb(0xa, 0xa0); - - setup_arm_irq(IRQ_ISA_PIC, &irq_isa); + if (isa_irq != -1) { + for (irq = _ISA_IRQ(0); irq < _ISA_IRQ(8); irq++) { + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = isa_mask_ack_pic_lo_irq; + irq_desc[irq].mask = isa_mask_pic_lo_irq; + irq_desc[irq].unmask = isa_unmask_pic_lo_irq; + } + + for (irq = _ISA_IRQ(8); irq < _ISA_IRQ(16); irq++) { + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = isa_mask_ack_pic_hi_irq; + irq_desc[irq].mask = isa_mask_pic_hi_irq; + irq_desc[irq].unmask = isa_unmask_pic_hi_irq; + } + + request_region(PIC_LO, 2, "pic1"); + request_region(PIC_HI, 2, "pic2"); setup_arm_irq(IRQ_ISA_CASCADE, &irq_cascade); + setup_arm_irq(isa_irq, &irq_cascade); } -#endif } diff --git a/include/asm-arm/arch-ebsa285/irqs.h b/include/asm-arm/arch-ebsa285/irqs.h index 6021bee6e..afb2e379d 100644 --- a/include/asm-arm/arch-ebsa285/irqs.h +++ b/include/asm-arm/arch-ebsa285/irqs.h @@ -3,55 +3,85 @@ * * Copyright (C) 1998 Russell King * Copyright (C) 1998 Phil Blundell + * + * Changelog: + * 20-Jan-1998 RMK Started merge of EBSA286, CATS and NetWinder + * 01-Feb-1999 PJB ISA IRQs start at 0 not 16 */ -#define NR_IRQS 48 +#define NR_IRQS 32 +#define NR_DC21285_IRQS 16 + +#define _ISA_IRQ(x) (0 + (x)) +#define _DC21285_IRQ(x) (16 + (x)) /* * This is a list of all interrupts that the 21285 - * can generate + * can generate and we handle. */ -#define IRQ_RESERVED 0 -#define IRQ_SOFTIRQ 1 -#define IRQ_CONRX 2 -#define IRQ_CONTX 3 -#define IRQ_TIMER1 4 -#define IRQ_TIMER2 5 -#define IRQ_TIMER3 6 -#define IRQ_TIMER4 7 -#define IRQ_IN0 8 -#define IRQ_IN1 9 -#define IRQ_IN2 10 -#define IRQ_IN3 11 -#define IRQ_XCS0 12 -#define IRQ_XCS1 13 -#define IRQ_XCS2 14 -#define IRQ_DOORBELLHOST 15 -#define IRQ_DMA1 16 -#define IRQ_DMA2 17 -#define IRQ_PCI 18 -#define IRQ_BIST 22 -#define IRQ_SERR 23 -#define IRQ_SDRAMPARITY 24 -#define IRQ_I2OINPOST 25 -#define IRQ_DISCARDTIMER 27 -#define IRQ_PCIDATAPARITY 28 -#define IRQ_PCIMASTERABORT 29 -#define IRQ_PCITARGETABORT 30 -#define IRQ_PCIPARITY 31 - -/* IRQs 32-47 are the 16 ISA interrupts on a CATS board. */ -#define IRQ_ISA_PIC IRQ_IN2 -#define IRQ_IS_ISA(_x) (((_x) >= 32) && ((_x) <= 47)) -#define IRQ_ISA(_x) ((_x) + 0x20) -#define IRQ_ISA_CASCADE IRQ_ISA(2) +#define IRQ_CONRX _DC21285_IRQ(0) +#define IRQ_CONTX _DC21285_IRQ(1) +#define IRQ_TIMER1 _DC21285_IRQ(2) +#define IRQ_TIMER2 _DC21285_IRQ(3) +#define IRQ_TIMER3 _DC21285_IRQ(4) +#define IRQ_IN0 _DC21285_IRQ(5) +#define IRQ_IN1 _DC21285_IRQ(6) +#define IRQ_IN2 _DC21285_IRQ(7) +#define IRQ_IN3 _DC21285_IRQ(8) +#define IRQ_DOORBELLHOST _DC21285_IRQ(9) +#define IRQ_DMA1 _DC21285_IRQ(10) +#define IRQ_DMA2 _DC21285_IRQ(11) +#define IRQ_PCI _DC21285_IRQ(12) +#define IRQ_SDRAMPARITY _DC21285_IRQ(13) +#define IRQ_I2OINPOST _DC21285_IRQ(14) +#define IRQ_PCI_ERR _DC21285_IRQ(15) + +#define IRQ_ISA_TIMER _ISA_IRQ(0) +#define IRQ_ISA_KEYBOARD _ISA_IRQ(1) +#define IRQ_ISA_CASCADE _ISA_IRQ(2) +#define IRQ_ISA_UART2 _ISA_IRQ(3) +#define IRQ_ISA_UART _ISA_IRQ(4) +#define IRQ_ISA_FLOPPY _ISA_IRQ(6) +#define IRQ_ISA_PRINTER _ISA_IRQ(7) +#define IRQ_ISA_RTC_ALARM _ISA_IRQ(8) +#define IRQ_ISA_2 _ISA_IRQ(9) +#define IRQ_ISA_PS2MOUSE _ISA_IRQ(12) +#define IRQ_ISA_HARDDISK1 _ISA_IRQ(14) +#define IRQ_ISA_HARDDISK2 _ISA_IRQ(15) + +#define IRQ_MASK_UART_RX (1 << 2) +#define IRQ_MASK_UART_TX (1 << 3) +#define IRQ_MASK_TIMER1 (1 << 4) +#define IRQ_MASK_TIMER2 (1 << 5) +#define IRQ_MASK_TIMER3 (1 << 6) +#define IRQ_MASK_IN0 (1 << 8) +#define IRQ_MASK_IN1 (1 << 9) +#define IRQ_MASK_IN2 (1 << 10) +#define IRQ_MASK_IN3 (1 << 11) +#define IRQ_MASK_DOORBELLHOST (1 << 15) +#define IRQ_MASK_DMA1 (1 << 16) +#define IRQ_MASK_DMA2 (1 << 17) +#define IRQ_MASK_PCI (1 << 18) +#define IRQ_MASK_SDRAMPARITY (1 << 24) +#define IRQ_MASK_I2OINPOST (1 << 25) +#define IRQ_MASK_PCI_ERR ((1 <<23) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30) | (1 << 31)) /* - * Now map them to the Linux interrupts + * Netwinder interrupt allocations */ -#define IRQ_TIMER IRQ_TIMER1 -#define IRQ_FLOPPYDISK IRQ_ISA(6) -#define IRQ_HARDDISK IRQ_ISA(14) -#define IRQ_HARDDISK_SECONDARY IRQ_ISA(15) +#define IRQ_NETWINDER_ETHER10 IRQ_IN0 +#define IRQ_NETWINDER_ETHER100 IRQ_IN1 +#define IRQ_NETWINDER_VIDCOMP IRQ_IN2 +#define IRQ_NETWINDER_PS2MOUSE _ISA_IRQ(5) +#define IRQ_NETWINDER_IR _ISA_IRQ(6) +#define IRQ_NETWINDER_BUTTON _ISA_IRQ(10) +#define IRQ_NETWINDER_VGA _ISA_IRQ(11) +#define IRQ_NETWINDER_SOUND _ISA_IRQ(12) + +#undef RTC_IRQ +#define RTC_IRQ IRQ_ISA_RTC_ALARM +#undef AUX_IRQ +#define AUX_IRQ (machine_is_netwinder() ? IRQ_NETWINDER_PS2MOUSE : IRQ_ISA_PS2MOUSE) +#define IRQ_FLOPPYDISK IRQ_ISA_FLOPPY -#define irq_cannonicalize(_i) (((_i) == IRQ_ISA_CASCADE) ? IRQ_ISA(9) : _i) +#define irq_cannonicalize(_i) (((_i) == IRQ_ISA_CASCADE) ? IRQ_ISA_2 : _i) diff --git a/include/asm-arm/arch-ebsa285/keyboard.h b/include/asm-arm/arch-ebsa285/keyboard.h index ad6eb0e5a..dcc7b49f9 100644 --- a/include/asm-arm/arch-ebsa285/keyboard.h +++ b/include/asm-arm/arch-ebsa285/keyboard.h @@ -6,20 +6,13 @@ * (C) 1998 Russell King * (C) 1998 Phil Blundell */ - -#include <linux/config.h> #include <asm/irq.h> #include <asm/system.h> -#define NR_SCANCODES 128 - -#ifdef CONFIG_CATS - -#define KEYBOARD_IRQ IRQ_ISA(1) +extern int have_isa_bridge; extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); -extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pckbd_unexpected_up(unsigned char keycode); @@ -27,46 +20,52 @@ extern void pckbd_leds(unsigned char leds); extern void pckbd_init_hw(void); extern unsigned char pckbd_sysrq_xlate[128]; -#define kbd_setkeycode pckbd_setkeycode -#define kbd_getkeycode pckbd_getkeycode -#define kbd_pretranslate pckbd_pretranslate -#define kbd_translate(sc, kcp, ufp, rm) ({ *ufp = sc & 0200; \ - pckbd_translate(sc & 0x7f, kcp, rm);}) +#define KEYBOARD_IRQ IRQ_ISA_KEYBOARD -#define kbd_unexpected_up pckbd_unexpected_up -#define kbd_leds pckbd_leds -#define kbd_init_hw() \ - do { if (machine_is_cats()) pckbd_init_hw(); } while (0) -#define kbd_sysrq_xlate pckbd_sysrq_xlate -#define kbd_disable_irq() -#define kbd_enable_irq() +#define NR_SCANCODES 128 -#define SYSRQ_KEY 0x54 +#define kbd_setkeycode(sc,kc) \ + ({ \ + int __ret; \ + if (have_isa_bridge) \ + __ret = pckbd_setkeycode(sc,kc);\ + else \ + __ret = -EINVAL; \ + __ret; \ + }) -#else +#define kbd_getkeycode(sc) \ + ({ \ + int __ret; \ + if (have_isa_bridge) \ + __ret = pckbd_getkeycode(sc); \ + else \ + __ret = -EINVAL; \ + __ret; \ + }) -/* Dummy keyboard definitions */ +#define kbd_translate(sc, kcp, rm) \ + ({ \ + pckbd_translate(sc, kcp, rm); \ + }) -#define kbd_setkeycode(sc,kc) (-EINVAL) -#define kbd_getkeycode(sc) (-EINVAL) +#define kbd_unexpected_up pckbd_unexpected_up -/* Prototype: int kbd_pretranslate(scancode, raw_mode) - * Returns : 0 to ignore scancode - */ -#define kbd_pretranslate(sc,rm) (1) +#define kbd_leds(leds) \ + do { \ + if (have_isa_bridge) \ + pckbd_leds(leds); \ + } while (0) + +#define kbd_init_hw() \ + do { \ + if (have_isa_bridge) \ + pckbd_init_hw(); \ + } while (0) + +#define kbd_sysrq_xlate pckbd_sysrq_xlate -/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) - * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag - * set to 0200 if scancode indicates release - */ -#define kbd_translate(sc, kcp, ufp, rm) (1) -#define kbd_unexpected_up(kc) (0200) -#define kbd_leds(leds) -#define kbd_init_hw() -//#define kbd_sysrq_xlate ps2kbd_sysrq_xlate #define kbd_disable_irq() #define kbd_enable_irq() -#define SYSRQ_KEY 13 - -#endif +#define SYSRQ_KEY 0x54 diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h new file mode 100644 index 000000000..a03cea639 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/memory.h @@ -0,0 +1,74 @@ +/* + * linux/include/asm-arm/arch-ebsa285/memory.h + * + * Copyright (c) 1996-1999 Russell King. + * + * Changelog: + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings. + * 17-May-1998 DAG Added __virt_to_bus and __bus_to_virt functions. + * 21-Nov-1998 RMK Changed __virt_to_bus and __bus_to_virt to macros. + * 21-Mar-1999 RMK Added PAGE_OFFSET for co285 architecture. + * Renamed to memory.h + * Moved PAGE_OFFSET and TASK_SIZE here + */ +#ifndef __ASM_ARCH_MMU_H +#define __ASM_ARCH_MMU_H + +#include <linux/config.h> + +#if defined(CONFIG_HOST_FOOTBRIDGE) + +/* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) + +/* + * Page offset: 3GB + */ +#define PAGE_OFFSET (0xc0000000UL) + +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) ((x) - 0xe0000000) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) ((x) + 0xe0000000) + +#elif defined(CONFIG_ADDIN_FOOTBRIDGE) + +#if defined(CONFIG_ARCH_CO285) + +/* + * Task size: 1.5GB + */ +#define TASK_SIZE (0x60000000UL) + +/* + * Page offset: 1.5GB + */ +#define PAGE_OFFSET (0x60000000UL) + +#else + +#error Add in your architecture here + +#endif + +#ifndef __ASSEMBLY__ +extern unsigned long __virt_to_bus(unsigned long); +extern unsigned long __bus_to_virt(unsigned long); +#endif + +#endif + +/* + * On Footbridge machines, the dram is contiguous. + * On Host Footbridge, these conversions are constant. + * On an add-in footbridge, these depend on register settings. + */ +#define __virt_to_phys__is_a_macro +#define __virt_to_phys(vpage) ((unsigned long)(vpage) - PAGE_OFFSET) +#define __phys_to_virt__is_a_macro +#define __phys_to_virt(ppage) ((unsigned long)(ppage) + PAGE_OFFSET) + +#endif diff --git a/include/asm-arm/arch-ebsa285/mm-init.h b/include/asm-arm/arch-ebsa285/mm-init.h deleted file mode 100644 index c6937abd0..000000000 --- a/include/asm-arm/arch-ebsa285/mm-init.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/mmap.h - * - * Copyright (C) 1996,1997,1998 Russell King - */ diff --git a/include/asm-arm/arch-ebsa285/mmu.h b/include/asm-arm/arch-ebsa285/mmu.h deleted file mode 100644 index b26aa8f66..000000000 --- a/include/asm-arm/arch-ebsa285/mmu.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa285/mmu.h - * - * Copyright (c) 1996,1997,1998 Russell King. - * - * Changelog: - * 20-10-1996 RMK Created - * 31-12-1997 RMK Fixed definitions to reduce warnings - * 17-05-1998 DAG Added __virt_to_bus and __bus_to_virt functions. - * 21-11-1998 RMK Changed __virt_to_bus and __bus_to_virt to macros. - */ -#ifndef __ASM_ARCH_MMU_H -#define __ASM_ARCH_MMU_H - -/* - * On ebsa285, the dram is contiguous - */ -#define __virt_to_phys__is_a_macro -#define __virt_to_phys(vpage) ((unsigned long)(vpage) - PAGE_OFFSET) -#define __phys_to_virt__is_a_macro -#define __phys_to_virt(ppage) ((unsigned long)(ppage) + PAGE_OFFSET) - -#define __virt_to_bus__is_a_macro -#define __virt_to_bus(x) ((x) - 0xe0000000) -#define __bus_to_virt__is_a_macro -#define __bus_to_virt(x) ((x) + 0xe0000000) - -#endif diff --git a/include/asm-arm/arch-ebsa285/oldlatches.h b/include/asm-arm/arch-ebsa285/oldlatches.h deleted file mode 100644 index 8ff6ebd67..000000000 --- a/include/asm-arm/arch-ebsa285/oldlatches.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Dummy oldlatches.h - * - * Copyright (C) 1996 Russell King - */ - -#ifdef __need_oldlatches -#error "Old latches not present in this (rpc) machine" -#endif diff --git a/include/asm-arm/arch-ebsa285/processor.h b/include/asm-arm/arch-ebsa285/processor.h index e98d1ff33..bd99869af 100644 --- a/include/asm-arm/arch-ebsa285/processor.h +++ b/include/asm-arm/arch-ebsa285/processor.h @@ -1,12 +1,17 @@ /* * linux/include/asm-arm/arch-ebsa110/processor.h * - * Copyright (C) 1996,1997,1998 Russell King + * Copyright (C) 1996-1999 Russell King + * + * Changelog: + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H #define __ASM_ARCH_PROCESSOR_H +#include <asm/arch/memory.h> + /* * Bus types */ @@ -15,17 +20,9 @@ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ -/* - * User space: 3GB - */ -#define TASK_SIZE (0xc0000000UL) - /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#define INIT_MMAP \ -{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } - #endif diff --git a/include/asm-arm/arch-ebsa285/serial.h b/include/asm-arm/arch-ebsa285/serial.h index c874f9dfa..63a699e66 100644 --- a/include/asm-arm/arch-ebsa285/serial.h +++ b/include/asm-arm/arch-ebsa285/serial.h @@ -10,8 +10,6 @@ #ifndef __ASM_ARCH_SERIAL_H #define __ASM_ARCH_SERIAL_H -#include <linux/config.h> - #include <asm/irq.h> /* @@ -23,13 +21,8 @@ */ #define BASE_BAUD (1843200 / 16) -#ifdef CONFIG_CATS -#define _SER_IRQ0 IRQ_ISA(4) -#define _SER_IRQ1 IRQ_ISA(3) -#else -#define _SER_IRQ0 0 -#define _SER_IRQ1 0 -#endif +#define _SER_IRQ0 IRQ_ISA_UART +#define _SER_IRQ1 IRQ_ISA_UART2 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h index 40d540dba..a8f94c198 100644 --- a/include/asm-arm/arch-ebsa285/system.h +++ b/include/asm-arm/arch-ebsa285/system.h @@ -3,6 +3,8 @@ * * Copyright (c) 1996,1997,1998 Russell King. */ +#include <asm/dec21285.h> +#include <asm/io.h> #include <asm/hardware.h> #include <asm/leds.h> @@ -16,14 +18,37 @@ extern __inline__ void arch_reset(char mode) mov r0, #0x130 mcr p15, 0, r0, c1, c0 @ MMU off mcr p15, 0, ip, c7, c7 @ flush caches - mov pc, lr"); + mov pc, lr" : : : "cc"); } else { - /* To reboot, we set up the 21285 watchdog and enable it. - * We then wait for it to timeout. - */ - *CSR_TIMER4_LOAD = 0x8000; - *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; - *CSR_SA110_CNTL |= 1 << 13; + if (machine_is_ebsa285() || machine_is_co285()) { + /* To reboot, we set up the 21285 watchdog and + * enable it. We then wait for it to timeout. + */ + *CSR_TIMER4_LOAD = 0x8000; + *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | + TIMER_CNTL_AUTORELOAD | + TIMER_CNTL_DIV16; + *CSR_SA110_CNTL |= 1 << 13; + } else if (machine_is_netwinder()) { + /* open up the SuperIO chip + */ + outb(0x87, 0x370); + outb(0x87, 0x370); + + /* aux function group 1 (logical device 7) + */ + outb(0x07, 0x370); + outb(0x07, 0x371); + + /* set GP16 for WD-TIMER output + */ + outb(0xe6, 0x370); + outb(0x00, 0x371); + + /* set a RED LED and toggle WD_TIMER for rebooting + */ + outb(0xc4, 0x338); + } } } diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h index 342e9528f..ed70ecf25 100644 --- a/include/asm-arm/arch-ebsa285/time.h +++ b/include/asm-arm/arch-ebsa285/time.h @@ -10,116 +10,346 @@ * 21-Mar-1998 RMK Created * 27-Aug-1998 PJB CATS support * 28-Dec-1998 APH Made leds optional + * 20-Jan-1999 RMK Started merge of EBSA285, CATS and NetWinder + * 16-Mar-1999 RMK More support for EBSA285-like machines with RTCs in */ -#define RTC_PORT(x) (0x72+(x)) -#define RTC_ALWAYS_BCD 1 +#define RTC_PORT(x) (rtc_base+(x)) +#define RTC_ALWAYS_BCD 0 #include <linux/config.h> +#include <linux/mc146818rtc.h> + +#include <asm/dec21285.h> #include <asm/leds.h> #include <asm/system.h> -#include <linux/mc146818rtc.h> -extern __inline__ unsigned long gettimeoffset (void) +static int rtc_base; +static unsigned long (*gettimeoffset)(void); +static int (*set_rtc_mmss)(unsigned long nowtime); +static long last_rtc_update = 0; /* last time the cmos clock got updated */ + +#ifdef CONFIG_LEDS +static void do_leds(void) +{ + static unsigned int count = 50; + static int last_pid; + + if (current->pid != last_pid) { + last_pid = current->pid; + if (last_pid) + leds_event(led_idle_end); + else + leds_event(led_idle_start); + } + + if (--count == 0) { + count = 50; + leds_event(led_timer); + } +} +#else +#define do_leds() +#endif + +#define mSEC_10_from_14 ((14318180 + 100) / 200) + +static unsigned long isa_gettimeoffset(void) +{ + int count; + + static int count_p = (mSEC_10_from_14/6); /* for the first call after boot */ + static unsigned long jiffies_p = 0; + + /* + * cache volatile jiffies temporarily; we have IRQs turned off. + */ + unsigned long jiffies_t; + + /* timer count may underflow right here */ + outb_p(0x00, 0x43); /* latch the count ASAP */ + + count = inb_p(0x40); /* read the latched count */ + + /* + * We do this guaranteed double memory access instead of a _p + * postfix in the previous port access. Wheee, hackady hack + */ + jiffies_t = jiffies; + + count |= inb_p(0x40) << 8; + + /* Detect timer underflows. If we haven't had a timer tick since + the last time we were called, and time is apparently going + backwards, the counter must have wrapped during this routine. */ + if ((jiffies_t == jiffies_p) && (count > count_p)) + count -= (mSEC_10_from_14/6); + else + jiffies_p = jiffies_t; + + count_p = count; + + count = (((mSEC_10_from_14/6)-1) - count) * tick; + count = (count + (mSEC_10_from_14/6)/2) / (mSEC_10_from_14/6); + + return count; +} + +static void isa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + if (machine_is_netwinder()) + do_leds(); + + do_timer(regs); + + /* If we have an externally synchronized linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 && + xtime.tv_sec > last_rtc_update + 660 && + xtime.tv_usec > 50000 - (tick >> 1) && + xtime.tv_usec < 50000 + (tick >> 1)) { + if (set_rtc_mmss(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else + last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + } +} + +static struct irqaction isa_timer_irq = { + isa_timer_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; + +__initfunc(static unsigned long +get_isa_cmos_time(void)) +{ + unsigned int year, mon, day, hour, min, sec; + int i; + + // check to see if the RTC makes sense..... + if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0) + return mktime(1970, 1, 1, 0, 0, 0); + + /* The Linux interpretation of the CMOS clock register contents: + * When the Update-In-Progress (UIP) flag goes from 1 to 0, the + * RTC registers show the second which has precisely just started. + * Let's hope other operating systems interpret the RTC the same way. + */ + /* read RTC exactly on falling edge of update flag */ + for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ + if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) + break; + + for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ + if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) + break; + + do { /* Isn't this overkill ? UIP above should guarantee consistency */ + sec = CMOS_READ(RTC_SECONDS); + min = CMOS_READ(RTC_MINUTES); + hour = CMOS_READ(RTC_HOURS); + day = CMOS_READ(RTC_DAY_OF_MONTH); + mon = CMOS_READ(RTC_MONTH); + year = CMOS_READ(RTC_YEAR); + } while (sec != CMOS_READ(RTC_SECONDS)); + + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { + BCD_TO_BIN(sec); + BCD_TO_BIN(min); + BCD_TO_BIN(hour); + BCD_TO_BIN(day); + BCD_TO_BIN(mon); + BCD_TO_BIN(year); + } + if ((year += 1900) < 1970) + year += 100; + return mktime(year, mon, day, hour, min, sec); +} + +static int +set_isa_cmos_time(unsigned long nowtime) +{ + int retval = 0; + int real_seconds, real_minutes, cmos_minutes; + unsigned char save_control, save_freq_select; + + save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ + CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); + + save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */ + CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); + + cmos_minutes = CMOS_READ(RTC_MINUTES); + if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) + BCD_TO_BIN(cmos_minutes); + + /* + * since we're only adjusting minutes and seconds, + * don't interfere with hour overflow. This avoids + * messing with unknown time zones but requires your + * RTC not to be off by more than 15 minutes + */ + real_seconds = nowtime % 60; + real_minutes = nowtime / 60; + if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1) + real_minutes += 30; /* correct for half hour time zone */ + real_minutes %= 60; + + if (abs(real_minutes - cmos_minutes) < 30) { + if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { + BIN_TO_BCD(real_seconds); + BIN_TO_BCD(real_minutes); + } + CMOS_WRITE(real_seconds,RTC_SECONDS); + CMOS_WRITE(real_minutes,RTC_MINUTES); + } else + retval = -1; + + /* The following flags have to be released exactly in this order, + * otherwise the DS12887 (popular MC146818A clone with integrated + * battery and quartz) will not reset the oscillator and will not + * update precisely 500 ms later. You won't find this mentioned in + * the Dallas Semiconductor data sheets, but who believes data + * sheets anyway ... -- Markus Kuhn + */ + CMOS_WRITE(save_control, RTC_CONTROL); + CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); + + return retval; +} + + + +static unsigned long __ebsa285_text timer1_gettimeoffset (void) { unsigned long value = LATCH - *CSR_TIMER1_VALUE; return (tick * value) / LATCH; } -extern __inline__ int reset_timer (void) +static void __ebsa285_text timer1_interrupt(int irq, void *dev_id, struct pt_regs *regs) { *CSR_TIMER1_CLR = 0; -#ifdef CONFIG_LEDS - /* - * Do the LEDs thing on EBSA-285 hardware. + /* Do the LEDs things on non-CATS hardware. */ - if (!machine_is_cats()) { - static unsigned int count = 50; - static int last_pid; - - if (current->pid != last_pid) { - last_pid = current->pid; - if (last_pid) - leds_event(led_idle_end); - else - leds_event(led_idle_start); - } - - if (--count == 0) { - count = 50; - leds_event(led_timer); - } + if (!machine_is_cats()) + do_leds(); + + do_timer(regs); + + /* If we have an externally synchronized linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 && + xtime.tv_sec > last_rtc_update + 660 && + xtime.tv_usec > 50000 - (tick >> 1) && + xtime.tv_usec < 50000 + (tick >> 1)) { + if (set_rtc_mmss(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else + last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } -#endif - - return 1; } -/* - * We don't have a RTC to update! - */ -#define update_rtc() +static struct irqaction __ebsa285_data timer1_irq = { + timer1_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; + +static int +set_dummy_time(unsigned long secs) +{ + return 1; +} /* * Set up timer interrupt, and return the current time in seconds. */ -extern __inline__ unsigned long setup_timer (void) +extern __inline__ void setup_timer(void) { - int year, mon, day, hour, min, sec; + switch(machine_arch_type) { + case MACH_TYPE_CO285: + /* + * Add-in 21285s shouldn't access the RTC + */ + rtc_base = 0; + break; - /* - * Default the date to 1 Jan 1970 0:0:0 - */ - year = 1970; mon = 1; day = 1; - hour = 0; min = 0; sec = 0; + default: + rtc_base = 0x70; + break; + } + + if (rtc_base) { + int reg_d, reg_b; - *CSR_TIMER1_CLR = 0; - *CSR_TIMER1_LOAD = LATCH; - *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; + reg_d = CMOS_READ(RTC_REG_D); - if (machine_is_cats()) - { - int i; /* - * Read the real time from the Dallas chip. (Code borrowed - * from arch/i386/kernel/time.c). + * make sure the divider is set */ - - /* The Linux interpretation of the CMOS clock register contents: - * When the Update-In-Progress (UIP) flag goes from 1 to 0, the - * RTC registers show the second which has precisely just started. - * Let's hope other operating systems interpret the RTC the same way. + CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_REG_A); + + /* + * Set control reg B + * (24 hour mode, update enabled) */ + reg_b = CMOS_READ(RTC_REG_B) & 0x7f; + reg_b |= 2; + CMOS_WRITE(reg_b, RTC_REG_B); - /* read RTC exactly on falling edge of update flag */ - for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ - if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) - break; - for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ - if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) - break; - do { /* Isn't this overkill ? UIP above should guarantee consistency */ - sec = CMOS_READ(RTC_SECONDS); - min = CMOS_READ(RTC_MINUTES); - hour = CMOS_READ(RTC_HOURS); - day = CMOS_READ(RTC_DAY_OF_MONTH); - mon = CMOS_READ(RTC_MONTH); - year = CMOS_READ(RTC_YEAR); - } while (sec != CMOS_READ(RTC_SECONDS)); - if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) - { - BCD_TO_BIN(sec); - BCD_TO_BIN(min); - BCD_TO_BIN(hour); - BCD_TO_BIN(day); - BCD_TO_BIN(mon); - BCD_TO_BIN(year); - } - if ((year += 1900) < 1970) - year += 100; + if ((CMOS_READ(RTC_REG_A) & 0x7f) == RTC_REF_CLCK_32KHZ && + CMOS_READ(RTC_REG_B) == reg_b) { + + /* + * Check the battery + */ + if ((reg_d & 0x80) == 0) + printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n"); + + xtime.tv_sec = get_isa_cmos_time(); + set_rtc_mmss = set_isa_cmos_time; + } else + rtc_base = 0; } - return mktime(year, mon, day, hour, min, sec); + if (!rtc_base) { + /* + * Default the date to 1 Jan 1970 0:0:0 + */ + xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0); + set_rtc_mmss = set_dummy_time; + } + + if (machine_is_ebsa285()) { + gettimeoffset = timer1_gettimeoffset; + + *CSR_TIMER1_CLR = 0; + *CSR_TIMER1_LOAD = LATCH; + *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; + + setup_arm_irq(IRQ_TIMER1, &timer1_irq); + } else { + /* enable PIT timer */ + /* set for periodic (4) and LSB/MSB write (0x30) */ + outb(0x34, 0x43); + outb((mSEC_10_from_14/6) & 0xFF, 0x40); + outb((mSEC_10_from_14/6) >> 8, 0x40); + + gettimeoffset = isa_gettimeoffset; + + setup_arm_irq(IRQ_ISA_TIMER, &isa_timer_irq); + } } diff --git a/include/asm-arm/arch-ebsa285/timex.h b/include/asm-arm/arch-ebsa285/timex.h index 0a730a70e..de5bffba8 100644 --- a/include/asm-arm/arch-ebsa285/timex.h +++ b/include/asm-arm/arch-ebsa285/timex.h @@ -7,8 +7,8 @@ */ /* - * On the EBSA, the clock ticks at weird rates. - * This is therefore not used to calculate the - * divisor. + * On EBSA285 boards, the clock runs at 50MHz and is + * divided by a 4-bit prescaler. Other boards use an + * ISA derived timer, and this is unused. */ #define CLOCK_TICK_RATE (50000000 / 16) diff --git a/include/asm-arm/arch-ebsa285/uncompress.h b/include/asm-arm/arch-ebsa285/uncompress.h index 7f655745f..e72e4f362 100644 --- a/include/asm-arm/arch-ebsa285/uncompress.h +++ b/include/asm-arm/arch-ebsa285/uncompress.h @@ -1,9 +1,12 @@ /* - * linux/include/asm-arm/arch-ebsa110/uncompress.h + * linux/include/asm-arm/arch-ebsa285/uncompress.h * * Copyright (C) 1996,1997,1998 Russell King */ +/* + * Note! This could cause problems on the NetWinder + */ #define BASE 0x42000160 static __inline__ void putc(char c) diff --git a/include/asm-arm/arch-nexuspci/a.out.h b/include/asm-arm/arch-nexuspci/a.out.h index 4972f5f70..1cc4d571d 100644 --- a/include/asm-arm/arch-nexuspci/a.out.h +++ b/include/asm-arm/arch-nexuspci/a.out.h @@ -1,15 +1,16 @@ /* * linux/include/asm-arm/arch-nexuspci/a.out.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996-1999 Russell King */ - #ifndef __ASM_ARCH_A_OUT_H #define __ASM_ARCH_A_OUT_H -#ifdef __KERNEL__ -#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#endif +#include <asm/arch/memory.h> + +#define STACK_TOP \ + ((current->personality == PER_LINUX_32BIT) ? \ + TASK_SIZE : 0x04000000) #endif diff --git a/include/asm-arm/arch-nexuspci/hardware.h b/include/asm-arm/arch-nexuspci/hardware.h index 6141bbf4c..2d267d89a 100644 --- a/include/asm-arm/arch-nexuspci/hardware.h +++ b/include/asm-arm/arch-nexuspci/hardware.h @@ -1,10 +1,12 @@ /* * linux/include/asm-arm/arch-nexuspci/hardware.h * - * Copyright (C) 1998 Philip Blundell + * Copyright (C) 1998-1999 Philip Blundell * * This file contains the hardware definitions of the Nexus PCI card. */ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H /* Logical Physical * 0xfff00000 0x10000000 SCC2691 DUART @@ -13,27 +15,17 @@ * 0xffc00000 0x60000000 PLX registers * 0xfe000000 0x70000000 PCI I/O */ - -#ifndef __ASM_ARCH_HARDWARE_H -#define __ASM_ARCH_HARDWARE_H - -/* - * What hardware must be present - */ - -#define HAS_PCIO -#define PCIO_BASE 0xfe000000 /* * Mapping areas */ -#define IO_BASE 0xfe000000 +#define PCIO_BASE 0xfe000000 +#define FLUSH_BASE 0xdf000000 /* * RAM definitions */ #define RAM_BASE 0x40000000 -#define KERNTOPHYS(a) ((unsigned long)(&a)) #define FLUSH_BASE_PHYS 0x40000000 #endif diff --git a/include/asm-arm/arch-nexuspci/irq.h b/include/asm-arm/arch-nexuspci/irq.h index 7b03006dd..000e6e75f 100644 --- a/include/asm-arm/arch-nexuspci/irq.h +++ b/include/asm-arm/arch-nexuspci/irq.h @@ -9,6 +9,8 @@ #include <asm/io.h> +#define fixup_irq(x) (x) + #define INTCONT 0xffe00000 extern unsigned long soft_irq_mask; diff --git a/include/asm-arm/arch-nexuspci/mmu.h b/include/asm-arm/arch-nexuspci/memory.h index 9ecce067f..e721c040d 100644 --- a/include/asm-arm/arch-nexuspci/mmu.h +++ b/include/asm-arm/arch-nexuspci/memory.h @@ -1,13 +1,24 @@ /* - * linux/include/asm-arm/arch-nexuspci/mmu.h + * linux/include/asm-arm/arch-nexuspci/memory.h * * Copyright (c) 1997, 1998 Philip Blundell. + * Copyright (c) 1999 Russell King * */ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H /* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) + +/* + * Page offset: 3GB + */ +#define PAGE_OFFSET (0xc0000000UL) + +/* * On NexusPCI, the DRAM is contiguous */ #define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + 0x40000000) diff --git a/include/asm-arm/arch-nexuspci/mm-init.h b/include/asm-arm/arch-nexuspci/mm-init.h deleted file mode 100644 index 93887c95d..000000000 --- a/include/asm-arm/arch-nexuspci/mm-init.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * linux/include/asm-arm/arch-nexuspci/mmap.h - * - * Copyright (C) 1998 Philip Blundell - */ diff --git a/include/asm-arm/arch-nexuspci/processor.h b/include/asm-arm/arch-nexuspci/processor.h index f722be87c..8349d6d46 100644 --- a/include/asm-arm/arch-nexuspci/processor.h +++ b/include/asm-arm/arch-nexuspci/processor.h @@ -1,13 +1,18 @@ /* - * linux/include/asm-arm/arch-ebsa110/processor.h + * linux/include/asm-arm/arch-nexuspci/processor.h * from linux/include/asm-arm/arch-ebsa110/processor.h * - * Copyright (C) 1996,1997,1998 Russell King + * Copyright (C) 1996-1999 Russell King + * + * Changelog: + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H #define __ASM_ARCH_PROCESSOR_H +#include <asm/arch/memory.h> + /* * Bus types */ @@ -16,17 +21,9 @@ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ -/* - * User space: 3GB - */ -#define TASK_SIZE (0xc0000000UL) - /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#define INIT_MMAP \ -{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } - #endif diff --git a/include/asm-arm/arch-nexuspci/time.h b/include/asm-arm/arch-nexuspci/time.h index 1f3fa401f..17f0ae472 100644 --- a/include/asm-arm/arch-nexuspci/time.h +++ b/include/asm-arm/arch-nexuspci/time.h @@ -17,37 +17,53 @@ extern __inline__ unsigned long gettimeoffset (void) return 0; } -extern __inline__ int reset_timer (void) +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { static int count = 50; + writeb(0x90, UART_BASE + 8); - if (--count == 0) - { + + if (--count == 0) { static int state = 1; state ^= 1; writeb(0x1a + state, INTCONT); count = 50; } + readb(UART_BASE + 0x14); readb(UART_BASE + 0x14); readb(UART_BASE + 0x14); readb(UART_BASE + 0x14); readb(UART_BASE + 0x14); readb(UART_BASE + 0x14); - return 1; + + do_timer(regs); } -extern __inline__ unsigned long setup_timer (void) +static struct irqaction timerirq = { + timer_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; + +extern __inline__ void setup_timer(void) { int tick = 3686400 / 16 / 2 / 100; + writeb(tick & 0xff, UART_BASE + 0x1c); writeb(tick >> 8, UART_BASE + 0x18); writeb(0x80, UART_BASE + 8); writeb(0x10, UART_BASE + 0x14); + /* * Default the date to 1 Jan 1970 0:0:0 * You will have to run a time daemon to set the * clock correctly at bootup */ - return mktime(1970, 1, 1, 0, 0, 0); + xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0); + + setup_arm_irq(IRQ_TIMER, &timerirq); } diff --git a/include/asm-arm/arch-rpc/a.out.h b/include/asm-arm/arch-rpc/a.out.h index 598614f23..56b2f4f7a 100644 --- a/include/asm-arm/arch-rpc/a.out.h +++ b/include/asm-arm/arch-rpc/a.out.h @@ -1,15 +1,16 @@ /* * linux/include/asm-arm/arch-rpc/a.out.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996-1999 Russell King */ - #ifndef __ASM_ARCH_A_OUT_H #define __ASM_ARCH_A_OUT_H -#ifdef __KERNEL__ -#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#endif +#include <asm/arch/memory.h> + +#define STACK_TOP \ + ((current->personality == PER_LINUX_32BIT) ? \ + TASK_SIZE : 0x04000000) #endif diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h index 8ca6273ff..0e3002f85 100644 --- a/include/asm-arm/arch-rpc/hardware.h +++ b/include/asm-arm/arch-rpc/hardware.h @@ -1,19 +1,19 @@ /* * linux/include/asm-arm/arch-rpc/hardware.h * - * Copyright (C) 1996 Russell King. + * Copyright (C) 1996-1999 Russell King. * * This file contains the hardware definitions of the RiscPC series machines. */ - #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H +#include <asm/arch/memory.h> + /* * What hardware must be present */ #define HAS_IOMD -#include <asm/iomd.h> #define HAS_VIDC20 /* Hardware addresses of major areas. @@ -26,7 +26,7 @@ #define EASI_SIZE 0x08000000 /* EASI I/O */ #define EASI_START 0x08000000 -#define EASI_BASE 0xe8000000 +#define EASI_BASE 0xe5000000 #define IO_START 0x03000000 /* I/O */ #define IO_SIZE 0x01000000 @@ -38,6 +38,8 @@ #define SCREEN1_END 0xd8000000 #define SCREEN1_BASE 0xd0000000 +#define FLUSH_BASE 0xdf000000 + #ifndef __ASSEMBLER__ @@ -47,8 +49,9 @@ #define IO_VIDC_AUDIO_BASE 0x80140000 #define IO_VIDC_BASE 0x80100000 #define IO_IOMD_BASE 0x80080000 +#define IOC_BASE 0x80080000 -#define IO_EC_EASI_BASE 0x82000000 +#define IO_EC_EASI_BASE 0x81400000 #define IO_EC_IOC4_BASE 0x8009c000 #define IO_EC_IOC_BASE 0x80090000 #define IO_EC_MEMC8_BASE 0x8000ac00 @@ -59,7 +62,6 @@ */ #define EXPMASK_BASE ((volatile unsigned char *)0xe0360000) #define IOEB_BASE ((volatile unsigned char *)0xe0350050) -#define IOC_BASE ((volatile unsigned char *)0xe0200000) #define PCIO_FLOPPYDMABASE ((volatile unsigned char *)0xe002a000) #define PCIO_BASE 0xe0010000 @@ -67,23 +69,19 @@ * Offsets from RAM base */ #define PARAMS_OFFSET 0x0100 -#define KERNEL_OFFSET 0x8000 /* * RAM definitions */ -#define MAPTOPHYS(x) (x) -#define KERNTOPHYS(x) ((unsigned long)(&x)) #define GET_MEMORY_END(p) (PAGE_OFFSET + p->u1.s.page_size * \ (p->u1.s.pages_in_bank[0] + \ p->u1.s.pages_in_bank[1] + \ p->u1.s.pages_in_bank[2] + \ p->u1.s.pages_in_bank[3])) -#define KERNEL_BASE (PAGE_OFFSET + KERNEL_OFFSET) #define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) #define Z_PARAMS_BASE (RAM_START + PARAMS_OFFSET) -#define SAFE_ADDR 0x00000000 /* ROM */ +#define FLUSH_BASE_PHYS 0x00000000 /* ROM */ #else diff --git a/include/asm-arm/arch-rpc/irq.h b/include/asm-arm/arch-rpc/irq.h index a65f487d4..ea284b9a5 100644 --- a/include/asm-arm/arch-rpc/irq.h +++ b/include/asm-arm/arch-rpc/irq.h @@ -7,6 +7,9 @@ * 10-10-1996 RMK Brought up to date with arch-sa110eval * 22-08-1998 RMK Restructured IRQ routines */ +#include <asm/iomd.h> + +#define fixup_irq(x) (x) static void rpc_mask_irq_ack_a(unsigned int irq) { diff --git a/include/asm-arm/arch-rpc/keyboard.h b/include/asm-arm/arch-rpc/keyboard.h index 6c04cf074..c083b08bb 100644 --- a/include/asm-arm/arch-rpc/keyboard.h +++ b/include/asm-arm/arch-rpc/keyboard.h @@ -10,8 +10,6 @@ #define NR_SCANCODES 128 -extern int ps2kbd_pretranslate(unsigned char scancode); -extern int ps2kbd_translate(unsigned char scancode, unsigned char *keycode_p, char *up_flag_p); extern void ps2kbd_leds(unsigned char leds); extern void ps2kbd_init_hw(void); extern unsigned char ps2kbd_sysrq_xlate[NR_SCANCODES]; @@ -19,20 +17,7 @@ extern unsigned char ps2kbd_sysrq_xlate[NR_SCANCODES]; #define kbd_setkeycode(sc,kc) (-EINVAL) #define kbd_getkeycode(sc) (-EINVAL) -/* Prototype: int kbd_pretranslate(scancode, raw_mode) - * Returns : 0 to ignore scancode - */ -#define kbd_pretranslate(sc,rm) ps2kbd_pretranslate(sc) - -/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) - * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag - * set to 0200 if scancode indicates release - */ -#ifdef NEW_KEYBOARD -#define kbd_translate(sc, kcp, ufp, rm) ps2kbd_translate(sc, kcp, ufp) -#else -#define kbd_translate(sc, kcp, rm) ({ unsigned int up_flag; ps2kbd_translate(sc, kcp, &up_flag); }) -#endif +#define kbd_translate(sc, kcp, rm) ({ *(kcp) = (sc); 1; }) #define kbd_unexpected_up(kc) (0200) #define kbd_leds(leds) ps2kbd_leds(leds) #define kbd_init_hw() ps2kbd_init_hw() diff --git a/include/asm-arm/arch-rpc/mmu.h b/include/asm-arm/arch-rpc/memory.h index 7fca09aaa..6922cd0f3 100644 --- a/include/asm-arm/arch-rpc/mmu.h +++ b/include/asm-arm/arch-rpc/memory.h @@ -1,19 +1,33 @@ /* - * linux/include/asm-arm/arch-rpc/mmu.h + * linux/include/asm-arm/arch-rpc/memory.h * * Copyright (c) 1996,1997,1998 Russell King. * * Changelog: - * 20-10-1996 RMK Created - * 31-12-1997 RMK Fixed definitions to reduce warnings - * 11-01-1998 RMK Uninlined to reduce hits on cache - * 08-02-1998 RMK Added __virt_to_bus and __bus_to_virt + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings + * 11-Jan-1998 RMK Uninlined to reduce hits on cache + * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt + * 21-Mar-1999 RMK Renamed to memory.h + * RMK Added TASK_SIZE and PAGE_OFFSET */ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H +/* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) + +/* + * Page offset: 3GB + */ +#define PAGE_OFFSET (0xc0000000UL) + +#ifndef __ASSEMBLY__ extern unsigned long __virt_to_phys(unsigned long vpage); extern unsigned long __phys_to_virt(unsigned long ppage); +#endif /* * These are exactly the same on the RiscPC as the diff --git a/include/asm-arm/arch-rpc/oldlatches.h b/include/asm-arm/arch-rpc/oldlatches.h deleted file mode 100644 index 8ff6ebd67..000000000 --- a/include/asm-arm/arch-rpc/oldlatches.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Dummy oldlatches.h - * - * Copyright (C) 1996 Russell King - */ - -#ifdef __need_oldlatches -#error "Old latches not present in this (rpc) machine" -#endif diff --git a/include/asm-arm/arch-rpc/processor.h b/include/asm-arm/arch-rpc/processor.h index 2fd9155b2..b2b6aec12 100644 --- a/include/asm-arm/arch-rpc/processor.h +++ b/include/asm-arm/arch-rpc/processor.h @@ -1,15 +1,18 @@ /* * linux/include/asm-arm/arch-rpc/processor.h * - * Copyright (c) 1996 Russell King. + * Copyright (c) 1996-1999 Russell King. * * Changelog: - * 10-09-1996 RMK Created + * 10-Sep-1996 RMK Created + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H #define __ASM_ARCH_PROCESSOR_H +#include <asm/arch/memory.h> + /* * Bus types */ @@ -18,17 +21,9 @@ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ -/* - * User space: 3GB - */ -#define TASK_SIZE (0xc0000000UL) - /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#define INIT_MMAP \ -{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } - #endif diff --git a/include/asm-arm/arch-rpc/system.h b/include/asm-arm/arch-rpc/system.h index e0a16f61d..bb220ced4 100644 --- a/include/asm-arm/arch-rpc/system.h +++ b/include/asm-arm/arch-rpc/system.h @@ -6,7 +6,7 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H -#include <asm/proc-fns.h> +#include <asm/iomd.h> #define arch_reset(mode) { \ extern void ecard_reset (int card); \ diff --git a/include/asm-arm/arch-rpc/time.h b/include/asm-arm/arch-rpc/time.h index 3d0f742da..b28666b37 100644 --- a/include/asm-arm/arch-rpc/time.h +++ b/include/asm-arm/arch-rpc/time.h @@ -8,6 +8,9 @@ * 10-Oct-1996 RMK Brought up to date with arch-sa110eval * 04-Dec-1997 RMK Updated for new arch/arm/time.c */ +#include <asm/iomd.h> + +static long last_rtc_update = 0; /* last time the cmos clock got updated */ extern __inline__ unsigned long gettimeoffset (void) { @@ -51,46 +54,148 @@ extern __inline__ unsigned long gettimeoffset (void) return offset; } -/* - * No need to reset the timer at every irq - */ -#define reset_timer() 1 +extern int iic_control(unsigned char, int, char *, int); -/* - * Updating of the RTC. We don't currently write the time to the - * CMOS clock. - */ -#define update_rtc() +static int set_rtc_time(unsigned long nowtime) +{ + char buf[5], ctrl; + + if (iic_control(0xa1, 0, &ctrl, 1) != 0) + printk("RTC: failed to read control reg\n"); + + /* + * Reset divider + */ + ctrl |= 0x80; + + if (iic_control(0xa0, 0, &ctrl, 1) != 0) + printk("RTC: failed to stop the clock\n"); + + /* + * We only set the time - we don't set the date. + * This means that there is the possibility once + * a day for the correction to disrupt the date. + * We really ought to write the time and date, or + * nothing at all. + */ + buf[0] = 0; + buf[1] = nowtime % 60; nowtime /= 60; + buf[2] = nowtime % 60; nowtime /= 60; + buf[3] = nowtime % 24; + + BIN_TO_BCD(buf[1]); + BIN_TO_BCD(buf[2]); + BIN_TO_BCD(buf[3]); + + if (iic_control(0xa0, 1, buf, 4) != 0) + printk("RTC: Failed to set the time\n"); + + /* + * Re-enable divider + */ + ctrl &= ~0x80; + + if (iic_control(0xa0, 0, &ctrl, 1) != 0) + printk("RTC: failed to start the clock\n"); + + return 0; +} + +extern __inline__ unsigned long get_rtc_time(void) +{ + unsigned int year, i; + char buf[8]; + + /* + * The year is not part of the RTC counter + * registers, and is stored in RAM. This + * means that it will not be automatically + * updated. + */ + if (iic_control(0xa1, 0xc0, buf, 1) != 0) + printk("RTC: failed to read the year\n"); + + /* + * If the year is before 1970, then the year + * is actually 100 in advance. This gives us + * a year 2070 bug... + */ + year = 1900 + buf[0]; + if (year < 1970) + year += 100; + + /* + * Read the time and date in one go - this + * will ensure that we don't get any effects + * due to carry (the RTC latches the counters + * during a read). + */ + if (iic_control(0xa1, 2, buf, 5) != 0) { + printk("RTC: failed to read the time and date\n"); + memset(buf, 0, sizeof(buf)); + } + + /*FIXME: + * This doesn't seem to work. Does RISC OS + * actually use the RTC year? It doesn't + * seem to. In that case, how does it update + * the CMOS year? + */ + /*year += (buf[3] >> 6) & 3;*/ + + /* + * The RTC combines years with date and weekday + * with month. We need to mask off this extra + * information before converting the date to + * binary. + */ + buf[4] &= 0x1f; + buf[3] &= 0x3f; +printk("Year %4d mon %02X day %02X hour %02X min %02X sec %02X\n", year, buf[4], buf[3], buf[2], buf[1], buf[0]); + for (i = 0; i < 5; i++) + BCD_TO_BIN(buf[i]); + + return mktime(year, buf[4], buf[3], buf[2], buf[1], buf[0]); +} + +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + do_timer(regs); + + /* If we have an externally synchronized linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 && + xtime.tv_sec > last_rtc_update + 660 && + xtime.tv_usec >= 50000 - (tick >> 1) && + xtime.tv_usec < 50000 + (tick >> 1)) { + if (set_rtc_time(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else + last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + } +} + +static struct irqaction timerirq = { + timer_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; /* * Set up timer interrupt, and return the current time in seconds. */ -extern __inline__ unsigned long setup_timer (void) +extern __inline__ void setup_timer(void) { - extern int iic_control (unsigned char, int, char *, int); - unsigned int year, mon, day, hour, min, sec; - char buf[8]; - outb(LATCH & 255, IOMD_T0LTCHL); outb(LATCH >> 8, IOMD_T0LTCHH); outb(0, IOMD_T0GO); - iic_control (0xa0, 0xc0, buf, 1); - year = buf[0]; - if ((year += 1900) < 1970) - year += 100; + xtime.tv_sec = get_rtc_time(); - iic_control (0xa0, 2, buf, 5); - mon = buf[4] & 0x1f; - day = buf[3] & 0x3f; - hour = buf[2]; - min = buf[1]; - sec = buf[0]; - BCD_TO_BIN(mon); - BCD_TO_BIN(day); - BCD_TO_BIN(hour); - BCD_TO_BIN(min); - BCD_TO_BIN(sec); - - return mktime(year, mon, day, hour, min, sec); + setup_arm_irq(IRQ_TIMER, &timerirq); } diff --git a/include/asm-arm/arch-rpc/uncompress.h b/include/asm-arm/arch-rpc/uncompress.h index 7740f0c3f..21701094a 100644 --- a/include/asm-arm/arch-rpc/uncompress.h +++ b/include/asm-arm/arch-rpc/uncompress.h @@ -5,7 +5,6 @@ */ #define VIDMEM ((char *)SCREEN_START) -#include "../arch/arm/drivers/char/font.h" #include <asm/hardware.h> #include <asm/io.h> diff --git a/include/asm-arm/arch-vnc/a.out.h b/include/asm-arm/arch-vnc/a.out.h deleted file mode 100644 index 011b08373..000000000 --- a/include/asm-arm/arch-vnc/a.out.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/a.out.h - * - * Copyright (C) 1996 Russell King - */ - -#ifndef __ASM_ARCH_A_OUT_H -#define __ASM_ARCH_A_OUT_H - -#ifdef __KERNEL__ -#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#endif - -#endif diff --git a/include/asm-arm/arch-vnc/dma.h b/include/asm-arm/arch-vnc/dma.h deleted file mode 100644 index f205f0376..000000000 --- a/include/asm-arm/arch-vnc/dma.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/dma.h - * - * Architecture DMA routes - * - * Copyright (C) 1997.1998 Russell King - */ -#ifndef __ASM_ARCH_DMA_H -#define __ASM_ARCH_DMA_H - -/* - * This is the maximum DMA address that can be DMAd to. - * There should not be more than (0xd0000000 - 0xc0000000) - * bytes of RAM. - */ -#define MAX_DMA_ADDRESS 0xd0000000 -#define MAX_DMA_CHANNELS 8 - -#endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-vnc/hardware.h b/include/asm-arm/arch-vnc/hardware.h deleted file mode 100644 index e95b1e7b6..000000000 --- a/include/asm-arm/arch-vnc/hardware.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/hardware.h - * - * Copyright (C) 1998 Corel Computer/Russell King. - * - * This file contains the hardware definitions of the VNC. - */ - -/* Logical Physical - * 0xffe00000 0x7c000000 PCI I/O space - * 0xfe000000 0x42000000 CSR - * 0xfd000000 0x78000000 Outbound write flush - * 0xfc000000 0x79000000 PCI IACK/special space - * 0xf9000000 0x7a000000 PCI Config type 1 - * 0xf8000000 0x7b000000 PCI Config type 0 - * - */ - -#include <asm/dec21285.h> - -#define IO_BASE_ARM_CSR 0xfe000000 -#define PCI_IACK 0xfc000000 - -/* LEDs */ -#define XBUS_LEDS ((volatile unsigned char *)0xfff12000) -#define XBUS_LED_AMBER (1 << 0) -#define XBUS_LED_GREEN (1 << 1) -#define XBUS_LED_RED (1 << 2) -#define XBUS_LED_TOGGLE (1 << 8) - -/* PIC irq control */ -#define PIC_LO 0x20 -#define PIC_MASK_LO 0x21 -#define PIC_HI 0xA0 -#define PIC_MASK_HI 0xA1 - -#define IO_END 0xffffffff -#define IO_BASE 0xe0000000 -#define IO_SIZE (IO_END - IO_BASE) - -#define HAS_PCIO -#define PCIO_BASE 0xffe00000 - -#define KERNTOPHYS(a) ((unsigned long)(&a)) - -//#define PARAMS_OFFSET 0x0100 -//#define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) - -#define FLUSH_BASE_PHYS 0x50000000 - -/* GPIO pins */ -#define GPIO_CCLK 0x800 -#define GPIO_DSCLK 0x400 -#define GPIO_E2CLK 0x200 -#define GPIO_IOLOAD 0x100 -#define GPIO_RED_LED 0x080 -#define GPIO_WDTIMER 0x040 -#define GPIO_DATA 0x020 -#define GPIO_IOCLK 0x010 -#define GPIO_DONE 0x008 -#define GPIO_FAN 0x004 -#define GPIO_GREEN_LED 0x002 -#define GPIO_RESET 0x001 - -/* CPLD pins */ -#define CPLD_DSRESET 8 -#define CPLD_UNMUTE 2 - -#ifndef __ASSEMBLY__ -extern void gpio_modify_op(int mask, int set); -extern void gpio_modify_io(int mask, int in); -extern int gpio_read(void); -extern void cpld_modify(int mask, int set); -#endif diff --git a/include/asm-arm/arch-vnc/ide.h b/include/asm-arm/arch-vnc/ide.h deleted file mode 100644 index c3761ab90..000000000 --- a/include/asm-arm/arch-vnc/ide.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/ide.h - * - * Copyright (c) 1998 Russell King - * - * Modifications: - * 29-07-1998 RMK Major re-work of IDE architecture specific code - */ -#include <asm/irq.h> - -/* - * Set up a hw structure for a specified data port, control port and IRQ. - * This should follow whatever the default interface uses. - */ -static __inline__ void -ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq) -{ - ide_ioreg_t reg = (ide_ioreg_t) data_port; - int i; - - memset(hw, 0, sizeof(*hw)); - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; - hw->irq = irq; -} - -/* - * This registers the standard ports for this architecture with the IDE - * driver. - */ -static __inline__ void -ide_init_default_hwifs(void) -{ - hw_regs_t hw; - - ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_HARDDISK); - ide_register_hw(&hw, NULL); -} diff --git a/include/asm-arm/arch-vnc/io.h b/include/asm-arm/arch-vnc/io.h deleted file mode 100644 index da1b48599..000000000 --- a/include/asm-arm/arch-vnc/io.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/io.h - * - * Copyright (C) 1997,1998 Russell King - * - * Modifications: - * 06-Dec-1997 RMK Created. - */ -#ifndef __ASM_ARM_ARCH_IO_H -#define __ASM_ARM_ARCH_IO_H - -/* - * This architecture does not require any delayed IO, and - * has the constant-optimised IO - */ -#undef ARCH_IO_DELAY - -/* - * Dynamic IO functions - let the compiler - * optimize the expressions - */ -#define DECLARE_DYN_OUT(fnsuffix,instr,typ) \ -extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ -{ \ - __asm__ __volatile__( \ - "str%?" ##instr## " %0, [%1, %2] @ out"###fnsuffix \ - : \ - : "r" (value), "r" (PCIO_BASE), typ (port)); \ -} - -#define DECLARE_DYN_IN(sz,fnsuffix,instr,typ) \ -extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ -{ \ - unsigned long value; \ - __asm__ __volatile__( \ - "ldr%?" ##instr## " %0, [%1, %2] @ in"###fnsuffix \ - : "=&r" (value) \ - : "r" (PCIO_BASE), typ (port)); \ - return (unsigned sz)value; \ -} - -extern __inline__ unsigned int __ioaddr (unsigned int port) \ -{ \ - return (unsigned int)(PCIO_BASE + port); \ -} - -#define DECLARE_IO(sz,fnsuffix,instr,typ) \ - DECLARE_DYN_OUT(fnsuffix,instr,typ) \ - DECLARE_DYN_IN(sz,fnsuffix,instr,typ) - -DECLARE_IO(char,b,"b","Jr") -DECLARE_IO(short,w,"h","r") -DECLARE_IO(long,l,"","Jr") - -#undef DECLARE_IO -#undef DECLARE_DYN_OUT -#undef DECLARE_DYN_IN - -/* - * Constant address IO functions - * - * These have to be macros for the 'J' constraint to work - - * +/-4096 immediate operand. - */ -#define __outbc(value,port) \ -({ \ - __asm__ __volatile__( \ - "strb %0, [%1, %2] @ outbc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ -}) - -#define __inbc(port) \ -({ \ - unsigned char result; \ - __asm__ __volatile__( \ - "ldrb %0, [%1, %2] @ inbc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "Jr" (port)); \ - result; \ -}) - -#define __outwc(value,port) \ -({ \ - __asm__ __volatile__( \ - "strh %0, [%1, %2] @ outwc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "r" (port)); \ -}) - -#define __inwc(port) \ -({ \ - unsigned short result; \ - __asm__ __volatile__( \ - "ldrh %0, [%1, %2] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "r" (port)); \ - result & 0xffff; \ -}) - -#define __outlc(value,port) \ -({ \ - __asm__ __volatile__( \ - "str %0, [%1, %2] @ outlc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ -}) - -#define __inlc(port) \ -({ \ - unsigned long result; \ - __asm__ __volatile__( \ - "ldr %0, [%1, %2] @ inlc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "Jr" (port)); \ - result; \ -}) - -#define __ioaddrc(port) \ -({ \ - unsigned long addr; \ - addr = PCIO_BASE + port; \ - addr; \ -}) - -/* - * Translated address IO functions - * - * IO address has already been translated to a virtual address - */ -#define outb_t(v,p) \ - (*(volatile unsigned char *)(p) = (v)) - -#define inb_t(p) \ - (*(volatile unsigned char *)(p)) - -#define outl_t(v,p) \ - (*(volatile unsigned long *)(p) = (v)) - -#define inl_t(p) \ - (*(volatile unsigned long *)(p)) - -/* - * This is not sufficient... (and it's a hack anyway) - */ -static inline void writeb(unsigned char b, unsigned int addr) -{ - *(volatile unsigned char *)(0xe0000000 + (addr)) = b; -} - -static inline unsigned char readb(unsigned int addr) -{ - return *(volatile unsigned char *)(0xe0000000 + (addr)); -} - -static inline void writew(unsigned short b, unsigned int addr) -{ - *(volatile unsigned short *)(0xe0000000 + (addr)) = b; -} - -static inline unsigned short readw(unsigned int addr) -{ - return *(volatile unsigned short *)(0xe0000000 + (addr)); -} - -static inline void writel(unsigned long b, unsigned int addr) -{ - *(volatile unsigned long *)(0xe0000000 + (addr)) = b; -} - -static inline unsigned long readl(unsigned int addr) -{ - return *(volatile unsigned long *)(0xe0000000 + (addr)); -} - -#endif diff --git a/include/asm-arm/arch-vnc/irq.h b/include/asm-arm/arch-vnc/irq.h deleted file mode 100644 index 10e4d0f9e..000000000 --- a/include/asm-arm/arch-vnc/irq.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * include/asm-arm/arch-vnc/irq.h - * - * Copyright (C) 1998 Russell King - * - * Changelog: - * 22-08-1998 RMK Restructured IRQ routines - */ - -#include <asm/dec21285.h> -#include <asm/irq.h> - -/* - * FootBridge IRQ translation table - * Converts form our IRQ numbers into FootBridge masks (defined in irqs.h) - */ -static int fb_irq_mask[16] = { - 0, - IRQ_MASK_SOFTIRQ, - IRQ_MASK_UART_DEBUG, - 0, - IRQ_MASK_TIMER0, - IRQ_MASK_TIMER1, - IRQ_MASK_TIMER2, - IRQ_MASK_WATCHDOG, - IRQ_MASK_ETHER10, - IRQ_MASK_ETHER100, - IRQ_MASK_VIDCOMP, - IRQ_MASK_EXTERN_IRQ, - IRQ_MASK_DMA1, - 0, - 0, - IRQ_MASK_PCI_ERR -}; - -static void vnc_mask_csr_irq(unsigned int irq) -{ - *CSR_IRQ_DISABLE = fb_irq_mask[irq]; -} - -static void vnc_unmask_csr_irq(unsigned int irq) -{ - *CSR_IRQ_ENABLE = fb_irq_mask[irq]; -} - -static void vnc_mask_pic_lo_irq(unsigned int irq) -{ - unsigned int mask = 1 << (irq & 7); - - outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); -} - -static void vnc_mask_ack_pic_lo_irq(unsigned int irq) -{ - unsigned int mask = 1 << (irq & 7); - - outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); - outb(0x20, PIC_LO); -} - -static void vnc_unmask_pic_lo_irq(unsigned int irq) -{ - unsigned int mask = ~(1 << (irq & 7)); - - outb(inb(PIC_MASK_LO) & mask, PIC_MASK_LO); -} - -static void vnc_mask_pic_hi_irq(unsigned int irq) -{ - unsigned int mask = 1 << (irq & 7); - - outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); -} - -static void vnc_mask_ack_pic_hi_irq(unsigned int irq) -{ - unsigned int mask = 1 << (irq & 7); - - outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); - outb(0x62, PIC_LO); - outb(0x20, PIC_HI); -} - -static void vnc_unmask_pic_hi_irq(unsigned int irq) -{ - unsigned int mask = 1 << (irq & 7); - - outb(inb(PIC_MASK_HI) & ~mask, PIC_MASK_HI); -} - -static void no_action(int irq, void *dev_id, struct pt_regs *regs) -{ -} - -static struct irqaction irq_cascade = { no_action, 0, 0, "cascade", NULL, NULL }; - -static __inline__ void irq_init_irq(void) -{ - unsigned int irq; - - outb(0x11, PIC_LO); - outb(0x10, PIC_MASK_LO); - outb(0x04, PIC_MASK_LO); - outb(1, PIC_MASK_LO); - - outb(0x11, PIC_HI); - outb(0x18, PIC_MASK_HI); - outb(0x02, PIC_MASK_HI); - outb(1, PIC_MASK_HI); - - *CSR_IRQ_DISABLE = ~IRQ_MASK_EXTERN_IRQ; - *CSR_IRQ_ENABLE = IRQ_MASK_EXTERN_IRQ; - *CSR_FIQ_DISABLE = -1; - - for (irq = 0; irq < NR_IRQS; irq++) { - irq_desc[irq].valid = 1; - irq_desc[irq].probe_ok = 1; - - if (irq < 16) { - irq_desc[irq].mask_ack = vnc_mask_csr_irq; - irq_desc[irq].mask = vnc_mask_csr_irq; - irq_desc[irq].unmask = vnc_unmask_csr_irq; - } else if (irq < 24) { -irq_desc[irq].probe_ok = 0; - irq_desc[irq].mask_ack = vnc_mask_ack_pic_lo_irq; - irq_desc[irq].mask = vnc_mask_pic_lo_irq; - irq_desc[irq].unmask = vnc_unmask_pic_lo_irq; - } else { -irq_desc[irq].probe_ok = 0; - irq_desc[irq].mask_ack = vnc_mask_ack_pic_hi_irq; - irq_desc[irq].mask = vnc_mask_pic_hi_irq; - irq_desc[irq].unmask = vnc_unmask_pic_hi_irq; - } - } - - irq_desc[0].probe_ok = 0; - irq_desc[IRQ_SOFTIRQ].probe_ok = 0; - irq_desc[IRQ_CONRX].probe_ok = 0; - irq_desc[IRQ_CONTX].probe_ok = 0; - irq_desc[IRQ_TIMER0].probe_ok = 0; - irq_desc[IRQ_TIMER1].probe_ok = 0; - irq_desc[IRQ_TIMER2].probe_ok = 0; - irq_desc[IRQ_WATCHDOG].probe_ok = 0; - irq_desc[IRQ_DMA1].probe_ok = 0; - irq_desc[13].probe_ok = 0; - irq_desc[14].probe_ok = 0; - irq_desc[IRQ_PCI_ERR].probe_ok = 0; - irq_desc[IRQ_PIC_HI].probe_ok = 0; - irq_desc[29].probe_ok = 0; - irq_desc[31].probe_ok = 0; - - outb(0xff, PIC_MASK_LO); - outb(0xff, PIC_MASK_HI); - - setup_arm_irq(IRQ_PIC_HI, &irq_cascade); -} diff --git a/include/asm-arm/arch-vnc/irqs.h b/include/asm-arm/arch-vnc/irqs.h deleted file mode 100644 index e9df93f5c..000000000 --- a/include/asm-arm/arch-vnc/irqs.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/irqs.h - * - * Copyright (C) 1998 Russell King - */ - -#define NR_IRQS 32 - -/* - * This is a list of all interrupts that the 21285 - * can generate - */ -#define IRQ_SOFTIRQ 1 /* from FB.1 */ -#define IRQ_CONRX 2 /* from FB.2 */ -#define IRQ_CONTX 3 /* from FB.3 */ -#define IRQ_TIMER0 4 /* from FB.4 */ -#define IRQ_TIMER1 5 /* from FB.5 */ -#define IRQ_TIMER2 6 /* from FB.6 */ -#define IRQ_WATCHDOG 7 /* from FB.7 */ -#define IRQ_ETHER10 8 /* from FB.8 */ -#define IRQ_ETHER100 9 /* from FB.9 */ -#define IRQ_VIDCOMP 10 /* from FB.10 */ -#define IRQ_EXTERN_IRQ 11 /* from FB.11: chain to IDE irq's */ -#define IRQ_DMA1 12 /* from future */ -#define IRQ_PCI_ERR 15 /* from FB.[28:31] */ - -#define IRQ_TIMER4 16 /* from 553.0 */ -#define IRQ_KEYBOARD 17 /* from 553.1 */ -#define IRQ_PIC_HI 18 /* from 533.2: chained to 553.[8:15] */ -#define IRQ_UART2 19 /* from 553.3 */ -#define IRQ_UART 20 /* from 553.4 */ -#define IRQ_MOUSE 21 /* from 553.5 */ -#define IRQ_UART_IR 22 /* from 553.6 */ -#define IRQ_PRINTER 23 /* from 553.7 */ -#define IRQ_RTC_ALARM 24 /* from 553.8 */ -#define IRQ_POWERLOW 26 /* from 553.10 */ -#define IRQ_VGA 27 /* from 553.11 */ -#define IRQ_SOUND 28 /* from 553.12 */ -#define IRQ_HARDDISK 30 /* from 553.14 */ - -/* These defines handle the translation from the above FB #defines - * into physical bits for the FootBridge IRQ registers - */ -#define IRQ_MASK_SOFTIRQ 0x00000002 -#define IRQ_MASK_UART_DEBUG 0x0000000C -#define IRQ_MASK_TIMER0 0x00000010 -#define IRQ_MASK_TIMER1 0x00000020 -#define IRQ_MASK_TIMER2 0x00000040 -#define IRQ_MASK_WATCHDOG 0x00000080 -#define IRQ_MASK_ETHER10 0x00000100 -#define IRQ_MASK_ETHER100 0x00000200 -#define IRQ_MASK_VIDCOMP 0x00000400 -#define IRQ_MASK_EXTERN_IRQ 0x00000800 -#define IRQ_MASK_DMA1 0x00030000 -#define IRQ_MASK_PCI_ERR 0xf8800000 - -/* - * Now map them to the Linux interrupts - */ -#undef IRQ_TIMER -#define IRQ_TIMER IRQ_TIMER0 -#undef RTC_IRQ -#define RTC_IRQ IRQ_RTC_ALARM -#undef AUX_IRQ -#define AUX_IRQ IRQ_MOUSE - -#define irq_cannonicalize(i) (i) diff --git a/include/asm-arm/arch-vnc/keyboard.h b/include/asm-arm/arch-vnc/keyboard.h deleted file mode 100644 index 2fa371ff9..000000000 --- a/include/asm-arm/arch-vnc/keyboard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/keyboard.h - * - * Keyboard driver definitions for VNC architecture - * - * (C) 1998 Russell King - */ - -#include <asm/irq.h> - -#define NR_SCANCODES 128 - -#define KEYBOARD_IRQ IRQ_KEYBOARD - -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); -extern int pckbd_getkeycode(unsigned int scancode); -extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, - char raw_mode); -extern char pckbd_unexpected_up(unsigned char keycode); -extern void pckbd_leds(unsigned char leds); -extern void pckbd_init_hw(void); -extern unsigned char pckbd_sysrq_xlate[128]; - -#define kbd_setkeycode pckbd_setkeycode -#define kbd_getkeycode pckbd_getkeycode -#define kbd_pretranslate pckbd_pretranslate -#define kbd_translate(sc, kcp, ufp, rm) ({ *ufp = sc & 0200; \ - pckbd_translate(sc & 0x7f, kcp, rm);}) - -#define kbd_unexpected_up pckbd_unexpected_up -#define kbd_leds pckbd_leds -#define kbd_init_hw() pckbd_init_hw() -#define kbd_sysrq_xlate pckbd_sysrq_xlate -#define kbd_disable_irq() -#define kbd_enable_irq() - -#define SYSRQ_KEY 0x54 diff --git a/include/asm-arm/arch-vnc/mm-init.h b/include/asm-arm/arch-vnc/mm-init.h deleted file mode 100644 index c6937abd0..000000000 --- a/include/asm-arm/arch-vnc/mm-init.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/mmap.h - * - * Copyright (C) 1996,1997,1998 Russell King - */ diff --git a/include/asm-arm/arch-vnc/mmu.h b/include/asm-arm/arch-vnc/mmu.h deleted file mode 100644 index 64e334292..000000000 --- a/include/asm-arm/arch-vnc/mmu.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/mmu.h - * - * Copyright (c) 1996,1997,1998 Russell King. - * - * Changelog: - * 20-10-1996 RMK Created - * 31-12-1997 RMK Fixed definitions to reduce warnings - */ -#ifndef __ASM_ARCH_MMU_H -#define __ASM_ARCH_MMU_H - -/* - * On ebsa, the dram is contiguous - */ -#define __virt_to_phys__is_a_macro -#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET) -#define __phys_to_virt__is_a_macro -#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET) - -#define __virt_to_bus__is_a_macro -#define __virt_to_bus(x) (x - 0xe0000000) -#define __bus_to_virt__is_a_macro -#define __bus_to_virt(x) (x + 0xe0000000) - -#endif diff --git a/include/asm-arm/arch-vnc/oldlatches.h b/include/asm-arm/arch-vnc/oldlatches.h deleted file mode 100644 index 8ff6ebd67..000000000 --- a/include/asm-arm/arch-vnc/oldlatches.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Dummy oldlatches.h - * - * Copyright (C) 1996 Russell King - */ - -#ifdef __need_oldlatches -#error "Old latches not present in this (rpc) machine" -#endif diff --git a/include/asm-arm/arch-vnc/param.h b/include/asm-arm/arch-vnc/param.h deleted file mode 100644 index c86000125..000000000 --- a/include/asm-arm/arch-vnc/param.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/param.h - * - * Copyright (C) 1996 Russell King - * Copyright (C) 1998 Philip Blundell - */ - -#define HZ 100 diff --git a/include/asm-arm/arch-vnc/processor.h b/include/asm-arm/arch-vnc/processor.h deleted file mode 100644 index 5d84ad498..000000000 --- a/include/asm-arm/arch-vnc/processor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/processor.h - * - * Copyright (C) 1996,1997,1998 Russell King - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* - * User space: 3GB - */ -#define TASK_SIZE (0xc0000000UL) - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#define INIT_MMAP \ -{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } - -#endif diff --git a/include/asm-arm/arch-vnc/serial.h b/include/asm-arm/arch-vnc/serial.h deleted file mode 100644 index 74fea49ce..000000000 --- a/include/asm-arm/arch-vnc/serial.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/serial.h - * - * Copyright (c) 1996 Russell King. - * - * Changelog: - * 15-10-1996 RMK Created - * 03-05-1998 RMK Modified for Corel Video NC - */ -#ifndef __ASM_ARCH_SERIAL_H -#define __ASM_ARCH_SERIAL_H - -#include <asm/irq.h> - -/* - * This assumes you have a 1.8432 MHz clock for your UART. - * - * It'd be nice if someone built a serial card with a 24.576 MHz - * clock, since the 16550A is capable of handling a top speed of 1.5 - * megabits/second; but this requires the faster clock. - */ -#define BASE_BAUD (1843200 / 16) - -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) - - /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ - { 0, BASE_BAUD, 0x3F8, IRQ_UART , STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, IRQ_UART2, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS3 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS4 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS5 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS6 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS7 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS8 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS9 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS10 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS11 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS13 */ - -#endif diff --git a/include/asm-arm/arch-vnc/shmparam.h b/include/asm-arm/arch-vnc/shmparam.h deleted file mode 100644 index 9c36489cb..000000000 --- a/include/asm-arm/arch-vnc/shmparam.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/shmparam.h - * - * Copyright (c) 1996 Russell King. - */ diff --git a/include/asm-arm/arch-vnc/system.h b/include/asm-arm/arch-vnc/system.h deleted file mode 100644 index dc21f08d8..000000000 --- a/include/asm-arm/arch-vnc/system.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/system.h - * - * Copyright (c) 1996,1997,1998 Russell King. - * Copyright (c) 1998 Corel Computer Corp. - */ -#include <asm/hardware.h> -#include <asm/dec21285.h> -#include <asm/leds.h> -#include <asm/io.h> - -extern __inline__ void arch_reset(char mode) -{ - cli(); - - /* open up the SuperIO chip - */ - outb(0x87, 0x370); - outb(0x87, 0x370); - - /* aux function group 1 (Logical Device 7) - */ - outb(0x07, 0x370); - outb(0x07, 0x371); - - /* set GP16 for WD-TIMER output - */ - outb(0xE6, 0x370); - outb(0x00, 0x371); - - /* set a RED LED and toggle WD_TIMER for rebooting... - */ - outb(0xC4, 0x338); -} - -#define arch_start_idle() leds_event(led_idle_start) -#define arch_end_idle() leds_event(led_idle_end) diff --git a/include/asm-arm/arch-vnc/time.h b/include/asm-arm/arch-vnc/time.h deleted file mode 100644 index c55000bdc..000000000 --- a/include/asm-arm/arch-vnc/time.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/time.h - * - * Copyright (c) 1997 Corel Computer Corp. - * Slight modifications to bring in line with ebsa285 port. - * -- Russell King. - * Added LED driver (based on the ebsa285 code) - Alex Holden 28/12/98. - */ - -#include <linux/config.h> -#include <linux/mc146818rtc.h> - -#include <asm/leds.h> -#include <asm/system.h> - -#undef IRQ_TIMER -#define IRQ_TIMER IRQ_TIMER4 - -#define mSEC_10_from_14 ((14318180 + 100) / 200) - -extern __inline__ unsigned long gettimeoffset (void) -{ - int count; - - static int count_p = (mSEC_10_from_14/6); /* for the first call after boot */ - static unsigned long jiffies_p = 0; - - /* - * cache volatile jiffies temporarily; we have IRQs turned off. - */ - unsigned long jiffies_t; - - /* timer count may underflow right here */ - outb_p(0x00, 0x43); /* latch the count ASAP */ - - count = inb_p(0x40); /* read the latched count */ - - /* - * We do this guaranteed double memory access instead of a _p - * postfix in the previous port access. Wheee, hackady hack - */ - jiffies_t = jiffies; - - count |= inb_p(0x40) << 8; - - /* Detect timer underflows. If we haven't had a timer tick since - the last time we were called, and time is apparently going - backwards, the counter must have wrapped during this routine. */ - if ((jiffies_t == jiffies_p) && (count > count_p)) - count -= (mSEC_10_from_14/6); - else - jiffies_p = jiffies_t; - - count_p = count; - - count = (((mSEC_10_from_14/6)-1) - count) * tick; - count = (count + (mSEC_10_from_14/6)/2) / (mSEC_10_from_14/6); - - return count; -} - -extern __inline__ int reset_timer (void) -{ -#ifdef CONFIG_LEDS - static unsigned int count = 50; - static int last_pid; - - if (current->pid != last_pid) { - last_pid = current->pid; - if (last_pid) - leds_event(led_idle_end); - else - leds_event(led_idle_start); - } - - if (--count == 0) { - count = 50; - leds_event(led_timer); - } -#endif - return 1; -} - -unsigned long set_rtc_mmss(unsigned long nowtime) -{ - int retval = 0; - int real_seconds, real_minutes, cmos_minutes; - unsigned char save_control, save_freq_select; - - save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ - CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); - - save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */ - CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); - - cmos_minutes = CMOS_READ(RTC_MINUTES); - if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) - BCD_TO_BIN(cmos_minutes); - - /* - * since we're only adjusting minutes and seconds, - * don't interfere with hour overflow. This avoids - * messing with unknown time zones but requires your - * RTC not to be off by more than 15 minutes - */ - real_seconds = nowtime % 60; - real_minutes = nowtime / 60; - if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1) - real_minutes += 30; /* correct for half hour time zone */ - real_minutes %= 60; - - if (abs(real_minutes - cmos_minutes) < 30) { - if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { - BIN_TO_BCD(real_seconds); - BIN_TO_BCD(real_minutes); - } - CMOS_WRITE(real_seconds,RTC_SECONDS); - CMOS_WRITE(real_minutes,RTC_MINUTES); - } else - retval = -1; - - /* The following flags have to be released exactly in this order, - * otherwise the DS12887 (popular MC146818A clone with integrated - * battery and quartz) will not reset the oscillator and will not - * update precisely 500 ms later. You won't find this mentioned in - * the Dallas Semiconductor data sheets, but who believes data - * sheets anyway ... -- Markus Kuhn - */ - CMOS_WRITE(save_control, RTC_CONTROL); - CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); - - return retval; -} - -/* - * We don't have a RTC to update! - */ -extern __inline__ void update_rtc(void) -{ - static long last_rtc_update = 0; /* last time the cmos clock got updated */ - - /* If we have an externally synchronized linux clock, then update - * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be - * called as close as possible to 500 ms before the new second starts. - */ - if (time_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 && - xtime.tv_usec > 50000 - (tick >> 1) && - xtime.tv_usec < 50000 + (tick >> 1)) { - if (set_rtc_mmss(xtime.tv_sec) == 0) - last_rtc_update = xtime.tv_sec; - else - last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ - } -} - -extern __inline__ unsigned long get_cmos_time(void) -{ - unsigned int year, mon, day, hour, min, sec; - int i; - - // check to see if the RTC makes sense..... - if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0) - return mktime(1970, 1, 1, 0, 0, 0); - - /* The Linux interpretation of the CMOS clock register contents: - * When the Update-In-Progress (UIP) flag goes from 1 to 0, the - * RTC registers show the second which has precisely just started. - * Let's hope other operating systems interpret the RTC the same way. - */ - /* read RTC exactly on falling edge of update flag */ - for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ - if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) - break; - - for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ - if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) - break; - - do { /* Isn't this overkill ? UIP above should guarantee consistency */ - sec = CMOS_READ(RTC_SECONDS); - min = CMOS_READ(RTC_MINUTES); - hour = CMOS_READ(RTC_HOURS); - day = CMOS_READ(RTC_DAY_OF_MONTH); - mon = CMOS_READ(RTC_MONTH); - year = CMOS_READ(RTC_YEAR); - } while (sec != CMOS_READ(RTC_SECONDS)); - - if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { - BCD_TO_BIN(sec); - BCD_TO_BIN(min); - BCD_TO_BIN(hour); - BCD_TO_BIN(day); - BCD_TO_BIN(mon); - BCD_TO_BIN(year); - } - if ((year += 1900) < 1970) - year += 100; - return mktime(year, mon, day, hour, min, sec); -} - -/* - * Set up timer interrupt, and return the current time in seconds. - */ -extern __inline__ unsigned long setup_timer (void) -{ - unsigned int c; - - /* Turn on the RTC */ - outb(13, 0x70); - if ((inb(0x71) & 0x80) == 0) - printk("RTC: *** warning: CMOS battery bad\n"); - - outb(10, 0x70); /* select control reg */ - outb(32, 0x71); /* make sure the divider is set */ - outb(11, 0x70); /* select other control reg */ - c = inb(0x71) & 0xfb; /* read it */ - outb(11, 0x70); - outb(c | 2, 0x71); /* turn on BCD counting and 24 hour clock mode */ - - /* enable PIT timer */ - /* set for periodic (4) and LSB/MSB write (0x30) */ - outb(0x34, 0x43); - outb((mSEC_10_from_14/6) & 0xFF, 0x40); - outb((mSEC_10_from_14/6) >> 8, 0x40); - - /* - * Default the date to 1 Jan 1970 00:00:00 - * You will have to run a time daemon to set the - * clock correctly at bootup - */ - return get_cmos_time(); -} diff --git a/include/asm-arm/arch-vnc/timex.h b/include/asm-arm/arch-vnc/timex.h deleted file mode 100644 index c50f118ff..000000000 --- a/include/asm-arm/arch-vnc/timex.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * linux/include/asm-arm/arch-vnc/timex.h - * - * Corel Video NC architecture timex specifications - * - * Copyright (C) 1998 Corel Computer/Russell King - */ - -/* - * On the VNC, the clock runs at 66MHz and is divided - * by a 4-bit prescaler. - */ -#define CLOCK_TICK_RATE (66000000 / 16) diff --git a/include/asm-arm/arch-vnc/uncompress.h b/include/asm-arm/arch-vnc/uncompress.h deleted file mode 100644 index d6097d43f..000000000 --- a/include/asm-arm/arch-vnc/uncompress.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/uncompress.h - * - * Copyright (C) 1996,1997,1998 Russell King - */ - -/* - * This does not append a newline - */ -static void puts(const char *s) -{ - __asm__ __volatile__(" - ldrb %0, [%2], #1 - teq %0, #0 - beq 3f -1: strb %0, [%3] -2: ldrb %1, [%3, #0x14] - and %1, %1, #0x60 - teq %1, #0x60 - bne 2b - teq %0, #'\n' - moveq %0, #'\r' - beq 1b - ldrb %0, [%2], #1 - teq %0, #0 - bne 1b -3: " : : "r" (0), "r" (0), "r" (s), "r" (0xf0000be0) : "cc"); -} - -/* - * nothing to do - */ -#define arch_decomp_setup() -#define arch_decomp_wdog() diff --git a/include/asm-arm/cache.h b/include/asm-arm/cache.h index c5b3c6659..48a830351 100644 --- a/include/asm-arm/cache.h +++ b/include/asm-arm/cache.h @@ -6,5 +6,6 @@ #define L1_CACHE_BYTES 32 #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) +#define SMP_CACHE_BYTES L1_CACHE_BYTES #endif diff --git a/include/asm-arm/dec21285.h b/include/asm-arm/dec21285.h index 0facd0b7c..e7bfa21c4 100644 --- a/include/asm-arm/dec21285.h +++ b/include/asm-arm/dec21285.h @@ -15,17 +15,20 @@ #define DC21285_PCI_MEM 0x80000000 #ifndef __ASSEMBLY__ -#define DC21285_IO(x) ((volatile unsigned long *)(0xfe000000+(x))) +#include <asm/arch/hardware.h> +#define DC21285_IO(x) ((volatile unsigned long *)(ARMCSR_BASE+(x))) #else #define DC21285_IO(x) (x) #endif #define CSR_PCICMD DC21285_IO(0x0004) +#define CSR_CLASSREV DC21285_IO(0x0008) #define CSR_PCICACHELINESIZE DC21285_IO(0x000c) #define CSR_PCICSRBASE DC21285_IO(0x0010) #define CSR_PCICSRIOBASE DC21285_IO(0x0014) #define CSR_PCISDRAMBASE DC21285_IO(0x0018) #define CSR_PCIROMBASE DC21285_IO(0x0030) +#define CSR_ROMWRITEREG DC21285_IO(0x0068) #define CSR_CSRBASEMASK DC21285_IO(0x00f8) #define CSR_CSRBASEOFFSET DC21285_IO(0x00fc) #define CSR_SDRAMBASEMASK DC21285_IO(0x0100) @@ -44,6 +47,33 @@ #define CSR_I2O_OUTPOSTCOUNT DC21285_IO(0x0134) #define CSR_I2O_INPOSTCOUNT DC21285_IO(0x0138) #define CSR_SA110_CNTL DC21285_IO(0x013c) +#define SA110_CNTL_INITCMPLETE (1 << 0) +#define SA110_CNTL_ASSERTSERR (1 << 1) +#define SA110_CNTL_RXSERR (1 << 3) +#define SA110_CNTL_SA110DRAMPARITY (1 << 4) +#define SA110_CNTL_PCISDRAMPARITY (1 << 5) +#define SA110_CNTL_DMASDRAMPARITY (1 << 6) +#define SA110_CNTL_DISCARDTIMER (1 << 8) +#define SA110_CNTL_PCINRESET (1 << 9) +#define SA110_CNTL_I2O_256 (0 << 10) +#define SA110_CNTL_I20_512 (1 << 10) +#define SA110_CNTL_I2O_1024 (2 << 10) +#define SA110_CNTL_I2O_2048 (3 << 10) +#define SA110_CNTL_I2O_4096 (4 << 10) +#define SA110_CNTL_I2O_8192 (5 << 10) +#define SA110_CNTL_I2O_16384 (6 << 10) +#define SA110_CNTL_I2O_32768 (7 << 10) +#define SA110_CNTL_WATCHDOG (1 << 13) +#define SA110_CNTL_ROMWIDTH_UNDEF (0 << 14) +#define SA110_CNTL_ROMWIDTH_16 (1 << 14) +#define SA110_CNTL_ROMWIDTH_32 (2 << 14) +#define SA110_CNTL_ROMWIDTH_8 (3 << 14) +#define SA110_CNTL_ROMACCESSTIME(x) ((x)<<16) +#define SA110_CNTL_ROMBURSTTIME(x) ((x)<<20) +#define SA110_CNTL_ROMTRISTATETIME(x) ((x)<<24) +#define SA110_CNTL_XCSDIR(x) ((x)<<28) +#define SA110_CNTL_PCICFN (1 << 31) + #define CSR_PCIADDR_EXTN DC21285_IO(0x0140) #define CSR_PREFETCHMEMRANGE DC21285_IO(0x0144) #define CSR_XBUS_CYCLE DC21285_IO(0x0148) diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h index 9fb7a0242..46d7cab05 100644 --- a/include/asm-arm/dma.h +++ b/include/asm-arm/dma.h @@ -6,20 +6,20 @@ typedef unsigned int dmach_t; #include <linux/config.h> #include <linux/kernel.h> #include <asm/irq.h> -#include <asm/system.h> #include <asm/spinlock.h> #include <asm/arch/dma.h> /* - * DMA modes - we have two, IN and OUT + * DMA modes */ typedef unsigned int dmamode_t; -#define DMA_MODE_MASK 1 +#define DMA_MODE_MASK 3 -#define DMA_MODE_READ 0 -#define DMA_MODE_WRITE 1 -#define DMA_AUTOINIT 2 +#define DMA_MODE_READ 0 +#define DMA_MODE_WRITE 1 +#define DMA_MODE_CASCADE 2 +#define DMA_AUTOINIT 4 typedef struct { unsigned long address; diff --git a/include/asm-arm/ecard.h b/include/asm-arm/ecard.h index 0f60505f9..56ae7ab35 100644 --- a/include/asm-arm/ecard.h +++ b/include/asm-arm/ecard.h @@ -47,6 +47,9 @@ #define MANU_ICS 0x003c #define PROD_ICS_IDE 0x00ae +#define MANU_ICS2 0x003d +#define PROD_ICS2_IDE 0x00ae + #define MANU_SERPORT 0x003f #define PROD_SERPORT_DSPORT 0x00b9 @@ -76,7 +79,7 @@ #define CONST const #endif -#define MAX_ECARDS 8 +#define MAX_ECARDS 9 typedef enum { /* Cards address space */ ECARD_IOC, @@ -116,14 +119,18 @@ typedef unsigned long *loader_t; typedef struct { /* Card handler routines */ void (*irqenable)(ecard_t *ec, int irqnr); void (*irqdisable)(ecard_t *ec, int irqnr); + int (*irqpending)(ecard_t *ec); void (*fiqenable)(ecard_t *ec, int fiqnr); void (*fiqdisable)(ecard_t *ec, int fiqnr); + int (*fiqpending)(ecard_t *ec); } expansioncard_ops_t; /* * This contains all the info needed on an expansion card */ struct expansion_card { + struct expansion_card *next; + /* Public data */ volatile unsigned char *irqaddr; /* address of IRQ register */ volatile unsigned char *fiqaddr; /* address of FIQ register */ @@ -135,10 +142,10 @@ struct expansion_card { void *fiq_data; /* Data for use for FIQ by card */ expansioncard_ops_t *ops; /* Enable/Disable Ops for card */ - CONST unsigned char slot_no; /* Slot number */ - CONST unsigned char dma; /* DMA number (for request_dma) */ - CONST unsigned char irq; /* IRQ number (for request_irq) */ - CONST unsigned char fiq; /* FIQ number (for request_irq) */ + CONST unsigned int slot_no; /* Slot number */ + CONST unsigned int dma; /* DMA number (for request_dma) */ + CONST unsigned int irq; /* IRQ number (for request_irq) */ + CONST unsigned int fiq; /* FIQ number (for request_irq) */ CONST card_type_t type; /* Type of card */ CONST struct in_ecid cid; /* Card Identification */ diff --git a/include/asm-arm/fiq.h b/include/asm-arm/fiq.h index 0516d115a..0e00841df 100644 --- a/include/asm-arm/fiq.h +++ b/include/asm-arm/fiq.h @@ -30,5 +30,6 @@ extern int claim_fiq(struct fiq_handler *f); extern void release_fiq(struct fiq_handler *f); extern void set_fiq_handler(void *start, unsigned int length); extern void set_fiq_regs(struct pt_regs *regs); +extern void get_fiq_regs(struct pt_regs *regs); #endif diff --git a/include/asm-arm/floppy.h b/include/asm-arm/floppy.h index 865e54035..784ca78c4 100644 --- a/include/asm-arm/floppy.h +++ b/include/asm-arm/floppy.h @@ -119,5 +119,20 @@ static int FDC2 = -1; #define FLOPPY_MOTOR_MASK 0xf0 #define CROSS_64KB(a,s) (0) + +/* + * This allows people to reverse the order of + * fd0 and fd1, in case their hardware is + * strangely connected (as some RiscPCs + * and A5000s seem to be). + */ +static void driveswap(int *ints, int dummy, int dummy2) +{ + floppy_selects[0][0] ^= floppy_selects[0][1]; + floppy_selects[0][1] ^= floppy_selects[0][0]; + floppy_selects[0][0] ^= floppy_selects[0][1]; +} + +#define EXTRA_FLOPPY_PARAMS ,{ "driveswap", &driveswap, NULL, 0, 0 } #endif diff --git a/include/asm-arm/hardware.h b/include/asm-arm/hardware.h index cd4528235..bc7854221 100644 --- a/include/asm-arm/hardware.h +++ b/include/asm-arm/hardware.h @@ -11,10 +11,6 @@ #include <asm/arch/hardware.h> -#ifndef FLUSH_BASE -#define FLUSH_BASE 0xdf000000 -#endif - #ifdef HAS_EXPMASK #ifndef __ASSEMBLER__ #define __EXPMASK(offset) (((volatile unsigned char *)EXPMASK_BASE)[offset]) diff --git a/include/asm-arm/init.h b/include/asm-arm/init.h index c0aa97f7f..66ccbecd3 100644 --- a/include/asm-arm/init.h +++ b/include/asm-arm/init.h @@ -5,7 +5,7 @@ /* C routines */ -#ifdef CONFIG_TEXT_INIT_SECTION +#ifdef CONFIG_TEXT_SECTIONS #define __init __attribute__ ((__section__ (".text.init"))) #define __initfunc(__arginit) \ diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index e87744b71..35db8e667 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -8,12 +8,35 @@ * constant addresses and variable addresses. * 04-Dec-1997 RMK Moved a lot of this stuff to the new architecture * specific IO header files. + * 27-Mar-1999 PJB Second parameter of memcpy_toio is const.. + * 04-Apr-1999 PJB Added check_signature. */ #ifndef __ASM_ARM_IO_H #define __ASM_ARM_IO_H +#ifdef __KERNEL__ + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); + +/* + * String version of IO memory access ops: + */ +extern void _memcpy_fromio(void *, unsigned long, unsigned long); +extern void _memcpy_toio(unsigned long, const void *, unsigned long); +extern void _memset_io(unsigned long, int, unsigned long); + +#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len)) +#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len)) +#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len)) + +#endif + #include <asm/hardware.h> -#include <asm/arch/mmu.h> +#include <asm/arch/memory.h> #include <asm/arch/io.h> #include <asm/proc/io.h> @@ -168,25 +191,43 @@ __IO(l,"",long) #endif -#undef ARCH_IO_DELAY -#undef ARCH_IO_CONSTANT +#ifndef ARCH_READWRITE -#ifdef __KERNEL__ +/* for panic */ +#include <linux/kernel.h> -extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); +#define readb(p) (panic("readb called, but not implemented"),0) +#define readw(p) (panic("readw called, but not implemented"),0) +#define readl(p) (panic("readl called, but not implemented"),0) +#define writeb(v,p) panic("writeb called, but not implemented") +#define writew(v,p) panic("writew called, but not implemented") +#define writel(v,p) panic("writel called, but not implemented") + +#endif /* - * String version of IO memory access ops: + * This isn't especially architecture dependent so it seems like it + * might as well go here as anywhere. */ -extern void _memcpy_fromio(void *, unsigned long, unsigned long); -extern void _memcpy_toio(unsigned long, void *, unsigned long); -extern void _memset_io(unsigned long, int, unsigned long); - -#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len)) -#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len)) -#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len)) - -#endif +static inline int check_signature(unsigned long io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; + do { + if (readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: + return retval; +} + +#undef ARCH_READWRITE +#undef ARCH_IO_DELAY +#undef ARCH_IO_CONSTANT #endif diff --git a/include/asm-arm/ioc.h b/include/asm-arm/ioc.h index 2b3d6062a..950046048 100644 --- a/include/asm-arm/ioc.h +++ b/include/asm-arm/ioc.h @@ -3,6 +3,8 @@ * read/write. */ +#ifndef IOC_CONTROL + #ifndef __ASSEMBLER__ #define __IOC(offset) (IOC_BASE + (offset >> 2)) #else @@ -54,3 +56,4 @@ #define IOC_T3GO __IOC(0x78) #define IOC_T3LATCH __IOC(0x7c) +#endif diff --git a/include/asm-arm/iomd.h b/include/asm-arm/iomd.h index 375c6fdf1..31be445da 100644 --- a/include/asm-arm/iomd.h +++ b/include/asm-arm/iomd.h @@ -125,6 +125,8 @@ #define DMA_ST_OFL 4 #define DMA_ST_INT 2 #define DMA_ST_AB 1 + +#ifndef IOC_CONTROL /* * IOC compatability */ @@ -155,6 +157,7 @@ #define IOC_T1LTCHH IOMD_T1LTCHH #define IOC_T1GO IOMD_T1GO #define IOC_T1LATCH IOMD_T1LATCH +#endif /* * DMA (MEMC) compatability diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h index 0e8c4ad27..9bdd7e00e 100644 --- a/include/asm-arm/irq.h +++ b/include/asm-arm/irq.h @@ -16,9 +16,11 @@ * capability */ #ifndef NO_IRQ -#define NO_IRQ 255 +#define NO_IRQ ((unsigned int)(-1)) #endif +#define disable_irq_nosync(i) disable_irq(i) + extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); diff --git a/include/asm-arm/leds.h b/include/asm-arm/leds.h index f69aa7fce..84a67f767 100644 --- a/include/asm-arm/leds.h +++ b/include/asm-arm/leds.h @@ -10,15 +10,32 @@ #ifndef ASM_ARM_LEDS_H #define ASM_ARM_LEDS_H +#include <linux/config.h> + typedef enum { led_idle_start, led_idle_end, led_timer, led_start, - led_stop + led_stop, + led_claim, /* override idle & timer leds */ + led_release, /* restore idle & timer leds */ + led_green_on, + led_green_off, + led_amber_on, + led_amber_off, + led_red_on, + led_red_off } led_event_t; /* Use this routine to handle LEDs */ -extern void leds_event(led_event_t); + +#ifdef CONFIG_LEDS +extern void (*leds_event)(led_event_t); +#define set_leds_event(r) leds_event = r +#else +#define leds_event(e) +#define set_leds_event(r) +#endif #endif diff --git a/include/asm-arm/memc.h b/include/asm-arm/memc.h index 820738a29..8eea08635 100644 --- a/include/asm-arm/memc.h +++ b/include/asm-arm/memc.h @@ -4,6 +4,9 @@ #define VDMA_START 1 #define VDMA_END 2 +#ifndef __ASSEMBLER__ +extern void memc_write(unsigned int reg, unsigned long val); + #define video_set_dma(start,end,offset) \ do { \ memc_write (VDMA_START, (start >> 2)); \ @@ -11,3 +14,4 @@ do { \ memc_write (VDMA_INIT, (offset >> 2)); \ } while (0) +#endif diff --git a/include/asm-arm/mm-init.h b/include/asm-arm/mm-init.h deleted file mode 100644 index 863e66259..000000000 --- a/include/asm-arm/mm-init.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * linux/include/asm-arm/mm-init.h - * - * Copyright (C) 1997,1998 Russell King - * - * Contained within are structures to describe how to set up the - * initial memory map. It includes both a processor-specific header - * for parsing these structures, and an architecture-specific header - * to fill out the structures. - */ -#ifndef __ASM_MM_INIT_H -#define __ASM_MM_INIT_H - -typedef enum { - // physical address is absolute - init_mem_map_absolute, - /* physical address is relative to start_mem - * as passed in paging_init - */ - init_mem_map_relative_start_mem -} init_memmap_type_t; - -typedef struct { - init_memmap_type_t type; - unsigned long physical_address; - unsigned long virtual_address; - unsigned long size; -} init_memmap_t; - -#define INIT_MEM_MAP_SENTINEL { init_mem_map_absolute, 0, 0, 0 } -#define INIT_MEM_MAP_ABSOLUTE(p,l,s) { init_mem_map_absolute,p,l,s } -#define INIT_MEM_MAP_RELATIVE(o,l,s) { init_mem_map_relative_start_mem,o,l,s } - -/* - * Within this file, initialise an array of init_mem_map_t's - * to describe your initial memory mapping structure. - */ -#include <asm/arch/mm-init.h> - -/* - * Contained within this file is code to read the array - * of init_mem_map_t's created above. - */ -#include <asm/proc/mm-init.h> - -#endif diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 810aa479e..704b99b05 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h @@ -1,15 +1,15 @@ #ifndef _ASMARM_PAGE_H #define _ASMARM_PAGE_H -#include <asm/arch/mmu.h> +#include <asm/arch/memory.h> #include <asm/proc/page.h> #ifdef __KERNEL__ #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) #define free_user_page(page, addr) free_page(addr) -#define clear_page(page) memzero((void *)(page), PAGE_SIZE) -#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) +#define clear_page(page) memzero((void *)(page), PAGE_SIZE) +#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) #endif diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index 5512cdd4c..084999561 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h @@ -11,5 +11,6 @@ extern int do_check_pgt_cache(int, int); /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (0) +#define kern_addr_valid(addr) (1) #endif /* _ASMARM_PGTABLE_H */ diff --git a/include/asm-arm/posix_types.h b/include/asm-arm/posix_types.h index 4c02ac5fe..102be60df 100644 --- a/include/asm-arm/posix_types.h +++ b/include/asm-arm/posix_types.h @@ -45,6 +45,8 @@ typedef struct { #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ } __kernel_fsid_t; +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + #undef __FD_SET #define __FD_SET(fd, fdsetp) \ (((fd_set *)fdsetp)->fds_bits[fd >> 5] |= (1<<(fd & 31))) @@ -62,3 +64,5 @@ typedef struct { (memset (fdsetp, 0, sizeof (*(fd_set *)fdsetp))) #endif + +#endif diff --git a/include/asm-arm/proc-armo/mm-init-flat.h b/include/asm-arm/proc-armo/mm-init-flat.h deleted file mode 100644 index 919ef59a4..000000000 --- a/include/asm-arm/proc-armo/mm-init-flat.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * linux/include/asm-arm/proc-armo/mmap.h - * - * Copyright (C) 1996 Russell King - * - * This contains the code to setup the memory map on an ARM2/ARM250/ARM3 - * machine. This is both processor & architecture specific, and requires - * some more work to get it to fit into our separate processor and - * architecture structure. - */ - -static unsigned long phys_screen_end; -int page_nr; - -#define setup_processor_functions() - -/* - * This routine needs more work to make it dynamically release/allocate mem! - */ -unsigned long map_screen_mem(unsigned long log_start, unsigned long kmem, int update) -{ - static int updated = 0; - unsigned long address = SCREEN_START, i; - pgd_t *pg_dir; - pmd_t *pm_dir; - pte_t *pt_entry; - - if (updated) - return 0; - updated = update; - - pg_dir = swapper_pg_dir + (SCREEN1_BASE >> PGDIR_SHIFT); - pm_dir = pmd_offset(pg_dir, SCREEN1_BASE); - pt_entry = pte_offset(pm_dir, SCREEN1_BASE); - - for (i = SCREEN1_BASE; i < SCREEN1_END; i += PAGE_SIZE) { - if (i >= log_start) { - *pt_entry = mk_pte(address, __pgprot(_PAGE_PRESENT)); - address += PAGE_SIZE; - } else - *pt_entry = mk_pte(0, __pgprot(0)); - pt_entry++; - } - phys_screen_end = address; - if (update) - flush_tlb_all (); - return kmem; -} - -static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem) -{ - unsigned long address; - unsigned int spi; - - page_nr = MAP_NR(end_mem); - - /* Allocate zero page */ - address = PAGE_OFFSET + 480*1024; - for (spi = 0; spi < 32768 >> PAGE_SHIFT; spi++) { - pgd_val(swapper_pg_dir[spi]) = pte_val(mk_pte(address, PAGE_READONLY)); - address += PAGE_SIZE; - } - - while (spi < (PAGE_OFFSET >> PGDIR_SHIFT)) - pgd_val(swapper_pg_dir[spi++]) = 0; - - map_screen_mem (SCREEN1_END - 480*1024, 0, 0); - return start_mem; -} - -static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) -{ - unsigned long smem = PAGE_ALIGN(*start_mem); - - while (smem < end_mem) { - clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); - smem += PAGE_SIZE; - } - - for (smem = phys_screen_end; smem < SCREEN2_END; smem += PAGE_SIZE) - clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); -} diff --git a/include/asm-arm/proc-armo/mm-init.h b/include/asm-arm/proc-armo/mm-init.h index ba4db9e82..ce0fd84e6 100644 --- a/include/asm-arm/proc-armo/mm-init.h +++ b/include/asm-arm/proc-armo/mm-init.h @@ -8,8 +8,8 @@ * some more work to get it to fit into our separate processor and * architecture structure. */ -extern unsigned long phys_screen_end; -extern unsigned long map_screen_mem(unsigned long log_start, unsigned long kmem, int update); +#include <asm/arch/memory.h> + int page_nr; #define setup_processor_functions() @@ -20,10 +20,11 @@ static inline void setup_swapper_dir (int index, pte_t *ptep) set_pmd (pmd_offset (swapper_pg_dir + index, 0), mk_pmd (ptep)); } -static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem) +static inline unsigned long +setup_pagetables(unsigned long start_mem, unsigned long end_mem) { unsigned int i; - union {unsigned long l; pte_t *pte; } u; + union { unsigned long l; pte_t *pte; } u; page_nr = MAP_NR(end_mem); @@ -37,14 +38,11 @@ static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned l for (i = 1; i < PTRS_PER_PGD; i++) pgd_val(swapper_pg_dir[i]) = 0; - /* now map screen mem in */ - phys_screen_end = SCREEN2_END; - map_screen_mem (SCREEN1_END - 480*1024, 0, 0); - return start_mem; } -static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) +static inline void +mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) { unsigned long smem; @@ -54,7 +52,4 @@ static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned l clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); smem += PAGE_SIZE; } - - for (smem = phys_screen_end; smem < SCREEN2_END; smem += PAGE_SIZE) - clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); } diff --git a/include/asm-arm/proc-armo/page.h b/include/asm-arm/proc-armo/page.h index 0e2b4501c..3768284a2 100644 --- a/include/asm-arm/proc-armo/page.h +++ b/include/asm-arm/proc-armo/page.h @@ -68,7 +68,6 @@ typedef unsigned long pgprot_t; #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) /* This handles the memory map.. */ -#define PAGE_OFFSET 0x02000000 #define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT) #endif /* __KERNEL__ */ diff --git a/include/asm-arm/proc-armo/pgtable-flat.h b/include/asm-arm/proc-armo/pgtable-flat.h deleted file mode 100644 index 994fa9f21..000000000 --- a/include/asm-arm/proc-armo/pgtable-flat.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * linux/include/asm-arm/proc-armo/pgtable.h - * - * Copyright (C) 1995, 1996 Russell King - */ -#ifndef __ASM_PROC_PGTABLE_H -#define __ASM_PROC_PGTABLE_H - -#include <asm/arch/mmu.h> - -#define LIBRARY_TEXT_START 0x0c000000 - -/* - * Cache flushing... - */ -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_range(mm,start,end) do { } while (0) -#define flush_cache_page(vma,vmaddr) do { } while (0) -#define flush_page_to_ram(page) do { } while (0) - -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages - */ - -#define flush_tlb() flush_tlb_mm(current->mm) - -extern __inline__ void flush_tlb_all(void) -{ - struct task_struct *p; - - p = &init_task; - do { - processor.u.armv2._update_map(p); - p = p->next_task; - } while (p != &init_task); - - processor.u.armv2._remap_memc (current); -} - -extern __inline__ void flush_tlb_mm(struct mm_struct *mm) -{ - struct task_struct *p; - - p = &init_task; - do { - if (p->mm == mm) - processor.u.armv2._update_map(p); - p = p->next_task; - } while (p != &init_task); - - if (current->mm == mm) - processor.u.armv2._remap_memc (current); -} - -#define flush_tlb_range(mm, start, end) flush_tlb_mm(mm) -#define flush_tlb_page(vma, vmaddr) flush_tlb_mm(vma->vm_mm) - -#define __flush_entry_to_ram(entry) - -/* Certain architectures need to do special things when pte's - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) - -/* PMD_SHIFT determines the size of the area a second-level page table can map */ -#define PMD_SHIFT PAGE_SHIFT -#define PMD_SIZE (1UL << PMD_SHIFT) -#define PMD_MASK (~(PMD_SIZE-1)) - -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define PGDIR_SHIFT PAGE_SHIFT -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE-1)) - -/* - * entries per page directory level: the arm3 is one-level, so - * we don't really have any PMD or PTE directory physically. - */ -#define PTRS_PER_PTE 1 -#define PTRS_PER_PMD 1 -#define PTRS_PER_PGD 1024 - -/* Just any arbitrary offset to the start of the vmalloc VM area: the - * current 8MB value just means that there will be a 8MB "hole" after the - * physical memory until the kernel virtual memory starts. That means that - * any out-of-bounds memory accesses will hopefully be caught. - * The vmalloc() routines leaves a hole of 4kB between each vmalloced - * area for the same reason. ;) - */ -#define VMALLOC_START 0x01a00000 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) - -#define _PAGE_PRESENT 0x001 -#define _PAGE_RW 0x002 -#define _PAGE_USER 0x004 -#define _PAGE_PCD 0x010 -#define _PAGE_ACCESSED 0x020 -#define _PAGE_DIRTY 0x040 - -#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) -#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) - -#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) - -/* - * The arm can't do page protection for execute, and considers that the same are read. - * Also, write permissions imply read permissions. This is the closest we can get.. - */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED - -#undef TEST_VERIFY_AREA - -/* - * BAD_PAGE is used for a bogus page. - * - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -extern pte_t __bad_page(void); -extern unsigned long *empty_zero_page; - -#define BAD_PAGE __bad_page() -#define ZERO_PAGE ((unsigned long) empty_zero_page) - -/* number of bits that fit into a memory pointer */ -#define BYTES_PER_PTR (sizeof(unsigned long)) -#define BITS_PER_PTR (8*BYTES_PER_PTR) - -/* to align the pointer to a pointer address */ -#define PTR_MASK (~(sizeof(void*)-1)) - -/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */ -#define SIZEOF_PTR_LOG2 2 - -/* to find an entry in a page-table */ -#define PAGE_PTR(address) \ -((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) - -/* to set the page-dir */ -#define SET_PAGE_DIR(tsk,pgdir) \ -do { \ - tsk->tss.memmap = (unsigned long)pgdir; \ - processor.u.armv2._update_map(tsk); \ - if ((tsk) == current) \ - processor.u.armv2._remap_memc (current); \ -} while (0) - -extern unsigned long physical_start; -extern unsigned long physical_end; - -extern inline int pte_none(pte_t pte) { return !pte_val(pte); } -extern inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } -extern inline void pte_clear(pte_t *ptep) { pte_val(*ptep) = 0; } - -extern inline int pmd_none(pmd_t pmd) { return 0; } -extern inline int pmd_bad(pmd_t pmd) { return 0; } -extern inline int pmd_present(pmd_t pmd) { return 1; } -extern inline void pmd_clear(pmd_t * pmdp) { } - -/* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pgd is never bad, and a pmd always exists (as it's folded - * into the pgd entry) - */ -extern inline int pgd_none(pgd_t pgd) { return 0; } -extern inline int pgd_bad(pgd_t pgd) { return 0; } -extern inline int pgd_present(pgd_t pgd) { return 1; } -extern inline void pgd_clear(pgd_t * pgdp) { } - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } -extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } -extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } -extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } -extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } -#define pte_cacheable(pte) 1 - -extern inline pte_t pte_nocache(pte_t pte) { return pte; } -extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_RW; return pte; } -extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } -extern inline pte_t pte_exprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } -extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } -extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } -extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } -extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } -extern inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } -extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } -extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ -extern inline pte_t mk_pte(unsigned long page, pgprot_t pgprot) -{ pte_t pte; pte_val(pte) = virt_to_phys(page) | pgprot_val(pgprot); return pte; } - -extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } - -extern inline unsigned long pte_page(pte_t pte) -{ return phys_to_virt(pte_val(pte) & PAGE_MASK); } - -extern inline unsigned long pmd_page(pmd_t pmd) -{ return phys_to_virt(pmd_val(pmd) & PAGE_MASK); } - -/* to find an entry in a page-table-directory */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + (address >> PGDIR_SHIFT); -} - -/* Find an entry in the second-level page table.. */ -#define pmd_offset(dir, address) ((pmd_t *)(dir)) - -/* Find an entry in the third-level page table.. */ -#define pte_offset(dir, address) ((pte_t *)(dir)) - -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ -extern inline void pte_free_kernel(pte_t * pte) -{ - pte_val(*pte) = 0; -} - -extern inline pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) -{ - return (pte_t *) pmd; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -#define pmd_free_kernel(pmdp) -#define pmd_alloc_kernel(pgd,address) ((pmd_t *)(pgd)) - -#define pte_free(ptep) -#define pte_alloc(pmd,address) ((pte_t *)(pmd)) - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -#define pmd_free(pmd) -#define pmd_alloc(pgd,address) ((pmd_t *)(pgd)) - -extern inline void pgd_free(pgd_t * pgd) -{ - extern void kfree(void *); - kfree((void *)pgd); -} - -extern inline pgd_t * pgd_alloc(void) -{ - pgd_t *pgd; - extern void *kmalloc(unsigned int, int); - - pgd = (pgd_t *) kmalloc(PTRS_PER_PGD * BYTES_PER_PTR, GFP_KERNEL); - if (pgd) - memset(pgd, 0, PTRS_PER_PGD * BYTES_PER_PTR); - return pgd; -} - -extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; - -#define update_mmu_cache(vma,address,pte) processor.u.armv2._update_mmu_cache(vma,address,pte) - -#define SWP_TYPE(entry) (((entry) >> 1) & 0x7f) -#define SWP_OFFSET(entry) ((entry) >> 8) -#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8)) - -#endif /* __ASM_PROC_PAGE_H */ - diff --git a/include/asm-arm/proc-armo/pgtable.h b/include/asm-arm/proc-armo/pgtable.h index 934902052..04516e729 100644 --- a/include/asm-arm/proc-armo/pgtable.h +++ b/include/asm-arm/proc-armo/pgtable.h @@ -7,9 +7,9 @@ #ifndef __ASM_PROC_PGTABLE_H #define __ASM_PROC_PGTABLE_H -#include <asm/arch/mmu.h> +#include <linux/config.h> #include <linux/slab.h> -#include <asm/arch/processor.h> /* For TASK_SIZE */ +#include <asm/arch/memory.h> /* For TASK_SIZE */ #define LIBRARY_TEXT_START 0x0c000000 @@ -280,13 +280,17 @@ extern __inline__ unsigned long pte_page(pte_t pte) return __phys_to_virt(pte_val(pte) & PAGE_MASK); } -extern __inline__ pmd_t mk_pmd (pte_t *ptep) +extern __inline__ pmd_t mk_pmd(pte_t *ptep) { pmd_t pmd; pmd_val(pmd) = __virt_to_phys((unsigned long)ptep) | _PAGE_TABLE; return pmd; } +/* these are aliases for the above function */ +#define mk_user_pmd(ptep) mk_pmd(ptep) +#define mk_kernel_pmd(ptep) mk_pmd(ptep) + #define set_pmd(pmdp,pmd) ((*(pmdp)) = (pmd)) extern __inline__ unsigned long pmd_page(pmd_t pmd) @@ -319,6 +323,7 @@ extern __inline__ pte_t * pte_offset(pmd_t *dir, unsigned long address) */ #ifndef __SMP__ +#ifndef CONFIG_NO_PGT_CACHE extern struct pgtable_cache_struct { unsigned long *pgd_cache; unsigned long *pte_cache; @@ -329,13 +334,16 @@ extern struct pgtable_cache_struct { #define pte_quicklist (quicklists.pte_cache) #define pgd_quicklist (quicklists.pgd_cache) #define pgtable_cache_size (quicklists.pgtable_cache_sz) +#endif #else #error Pgtable caches have to be per-CPU, so that no locking is needed. #endif extern pgd_t *get_pgd_slow(void); +extern void free_table(void *table); +#ifndef CONFIG_NO_PGT_CACHE extern __inline__ pgd_t *get_pgd_fast(void) { unsigned long *ret; @@ -355,14 +363,17 @@ extern __inline__ void free_pgd_fast(pgd_t *pgd) pgd_quicklist = (unsigned long *) pgd; pgtable_cache_size++; } +#endif +/* keep this as an inline so we get type checking */ extern __inline__ void free_pgd_slow(pgd_t *pgd) { - kfree(pgd); + free_table((void *)pgd); } extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); +#ifndef CONFIG_NO_PGT_CACHE extern __inline__ pte_t *get_pte_fast(void) { unsigned long *ret; @@ -381,10 +392,12 @@ extern __inline__ void free_pte_fast(pte_t *pte) pte_quicklist = (unsigned long *) pte; pgtable_cache_size++; } +#endif +/* keep this as an inline so we get type checking */ extern __inline__ void free_pte_slow(pte_t *pte) { - kfree(pte); + free_table((void *)pte); } /* We don't use pmd cache, so this is a dummy routine */ @@ -404,6 +417,26 @@ extern __inline__ void free_pmd_slow(pmd_t *pmd) extern void __bad_pmd(pmd_t *pmd); extern void __bad_pmd_kernel(pmd_t *pmd); +#ifdef CONFIG_NO_PGT_CACHE +#define pte_free_kernel(pte) free_pte_slow(pte) +#define pte_free(pte) free_pte_slow(pte) +#define pgd_free(pgd) free_pgd_slow(pgd) +#define pgd_alloc() get_pgd_slow() + +extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none (*pmd)) { + return get_pte_slow(pmd, address); + } + if (pmd_bad (*pmd)) { + __bad_pmd(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} +#else #define pte_free_kernel(pte) free_pte_fast(pte) #define pte_free(pte) free_pte_fast(pte) #define pgd_free(pgd) free_pgd_fast(pgd) @@ -427,6 +460,7 @@ extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) } return (pte_t *) pmd_page(*pmd) + address; } +#endif /* * allocating and freeing a pmd is trivial: the 1-entry pmd is @@ -448,7 +482,6 @@ extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) { struct task_struct * p; - pgd_t *pgd; read_lock(&tasklist_lock); for_each_task(p) { @@ -457,8 +490,14 @@ extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) *pgd_offset(p->mm,address) = entry; } read_unlock(&tasklist_lock); - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; +#ifndef CONFIG_NO_PGT_CACHE + { + pgd_t *pgd; + for (pgd = (pgd_t *)pgd_quicklist; pgd; + pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; + } +#endif } extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h index 4a8b60d10..4cfd77955 100644 --- a/include/asm-arm/proc-armo/processor.h +++ b/include/asm-arm/proc-armo/processor.h @@ -14,8 +14,6 @@ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H -#ifdef __KERNEL__ - #include <asm/assembler.h> #include <linux/string.h> @@ -32,6 +30,8 @@ struct context_save_struct { unsigned long pc; }; +#define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, SVC26_MODE } + typedef struct { void (*put_byte)(void); /* Special calling convention */ void (*get_byte)(void); /* Special calling convention */ @@ -50,50 +50,13 @@ extern uaccess_t uaccess_user, uaccess_kernel; #define EXTRA_THREAD_STRUCT \ uaccess_t *uaccess; /* User access functions*/ \ - struct context_save_struct *save; \ - unsigned long memmap; \ unsigned long memcmap[256]; #define EXTRA_THREAD_STRUCT_INIT \ - &uaccess_kernel, \ - 0, \ - (unsigned long) swapper_pg_dir, \ + ,&uaccess_kernel, \ { 0, } -DECLARE_THREAD_STRUCT; - -/* - * Return saved PC of a blocked thread. - */ -extern __inline__ unsigned long thread_saved_pc (struct thread_struct *t) -{ - if (t->save) - return t->save->pc & ~PCMASK; - else - return 0; -} - -extern __inline__ unsigned long get_css_fp (struct thread_struct *t) -{ - if (t->save) - return t->save->fp; - else - return 0; -} - -asmlinkage void ret_from_sys_call(void) __asm__("ret_from_sys_call"); - -extern __inline__ void copy_thread_css (struct context_save_struct *save) -{ - save->r4 = - save->r5 = - save->r6 = - save->r7 = - save->r8 = - save->r9 = - save->fp = 0; - save->pc = ((unsigned long)ret_from_sys_call) | SVC26_MODE; -} +#define SWAPPER_PG_DIR ((unsigned long)swapper_pg_dir) #define start_thread(regs,pc,sp) \ ({ \ @@ -105,18 +68,16 @@ extern __inline__ void copy_thread_css (struct context_save_struct *save) regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ - flush_tlb_mm(current->mm); \ }) /* Allocation and freeing of basic task resources. */ /* * NOTE! The task struct and the stack go together */ -#define alloc_task_struct() \ - ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) -#define free_task_struct(p) free_pages((unsigned long)(p),1) +extern unsigned long get_page_8k(int priority); +extern void free_page_8k(unsigned long page); - -#endif +#define ll_alloc_task_struct() ((struct task_struct *)get_page_8k(GFP_KERNEL)) +#define ll_free_task_struct(p) free_page_8k((unsigned long)(p)) #endif diff --git a/include/asm-arm/proc-armo/ptrace.h b/include/asm-arm/proc-armo/ptrace.h index 30a05ecdc..f53aa229d 100644 --- a/include/asm-arm/proc-armo/ptrace.h +++ b/include/asm-arm/proc-armo/ptrace.h @@ -68,8 +68,13 @@ struct pt_regs { /* Are the current registers suitable for user mode? * (used to maintain security in signal handlers) */ -#define valid_user_regs(regs) \ - (user_mode(regs) && ((regs)->ARM_sp & 3) == 0) +static inline int valid_user_regs(struct pt_regs *regs) +{ + if (!user_mode(regs) || regs->ARM_pc & (F_BIT | I_BIT)) + return 1; + + return 0; +} #endif diff --git a/include/asm-arm/proc-armo/semaphore.h b/include/asm-arm/proc-armo/semaphore.h index 483803217..9cd99cf50 100644 --- a/include/asm-arm/proc-armo/semaphore.h +++ b/include/asm-arm/proc-armo/semaphore.h @@ -13,17 +13,19 @@ extern inline void down(struct semaphore * sem) __asm__ __volatile__ (" @ atomic down operation mov r0, pc - orr r1, r0, #0x08000000 + orr lr, r0, #0x08000000 and r0, r0, #0x0c000003 - teqp r1, #0 - ldr r1, [%0] - subs r1, r1, #1 - str r1, [%0] - mov r1, pc, lsr #28 - teqp r0, r1, lsl #28 + teqp lr, #0 + ldr lr, [%0] + subs lr, lr, #1 + str lr, [%0] + mov lr, pc, lsr #28 + teqp r0, lr, lsl #28 movmi r0, %0 - blmi " SYMBOL_NAME_STR(__down) - : : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + blmi " SYMBOL_NAME_STR(__down_failed) + : + : "r" (sem) + : "r0", "lr", "cc"); } /* @@ -36,22 +38,47 @@ extern inline int down_interruptible (struct semaphore * sem) __asm__ __volatile__ (" @ atomic down operation mov r0, pc - orr r1, r0, #0x08000000 + orr lr, r0, #0x08000000 and r0, r0, #0x0c000003 - teqp r1, #0 - ldr r1, [%1] - subs r1, r1, #1 - str r1, [%1] - mov r1, pc, lsr #28 + teqp lr, #0 + ldr lr, [%1] + subs lr, lr, #1 + str lr, [%1] + mov lr, pc, lsr #28 orrmi r0, r0, #0x80000000 @ set N - teqp r0, r1, lsl #28 + teqp r0, lr, lsl #28 movmi r0, %1 movpl r0, #0 - blmi " SYMBOL_NAME_STR(__down_interruptible) " + blmi " SYMBOL_NAME_STR(__down_interruptible_failed) " mov %0, r0" : "=r" (result) : "r" (sem) - : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + : "r0", "lr", "cc"); + return result; +} + +extern inline int down_trylock(struct semaphore * sem) +{ + int result; + __asm__ __volatile__ (" + @ atomic down operation + mov r0, pc + orr lr, r0, #0x08000000 + and r0, r0, #0x0c000003 + teqp lr, #0 + ldr lr, [%1] + subs lr, lr, #1 + str lr, [%1] + mov lr, pc, lsr #28 + orrmi r0, r0, #0x80000000 @ set N + teqp r0, lr, lsl #28 + movmi r0, %1 + movpl r0, #0 + blmi " SYMBOL_NAME_STR(__down_trylock_failed) " + mov %0, r0" + : "=r" (result) + : "r" (sem) + : "r0", "lr", "cc"); return result; } @@ -66,18 +93,20 @@ extern inline void up(struct semaphore * sem) __asm__ __volatile__ (" @ atomic up operation mov r0, pc - orr r1, r0, #0x08000000 + orr lr, r0, #0x08000000 and r0, r0, #0x0c000003 - teqp r1, #0 - ldr r1, [%0] - adds r1, r1, #1 - str r1, [%0] - mov r1, pc, lsr #28 + teqp lr, #0 + ldr lr, [%0] + adds lr, lr, #1 + str lr, [%0] + mov lr, pc, lsr #28 orrls r0, r0, #0x80000000 @ set N - teqp r0, r1, lsl #28 + teqp r0, lr, lsl #28 movmi r0, %0 - blmi " SYMBOL_NAME_STR(__up) - : : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + blmi " SYMBOL_NAME_STR(__up_wakeup) + : + : "r" (sem) + : "r0", "lr", "cc"); } #endif diff --git a/include/asm-arm/proc-armv/io.h b/include/asm-arm/proc-armv/io.h index 461da303f..8afecd2a5 100644 --- a/include/asm-arm/proc-armv/io.h +++ b/include/asm-arm/proc-armv/io.h @@ -22,17 +22,14 @@ #include <asm/proc-fns.h> -extern inline void dma_cache_inv(unsigned long start, unsigned long size) -{ - processor.u.armv3v4._cache_purge_area(start, start + size); -} +#define dma_cache_inv(start, size) \ + do { processor.u.armv3v4._cache_purge_area((unsigned long)(start), \ + ((unsigned long)(start)+(size))); } while (0) -extern inline void dma_cache_wback(unsigned long start, unsigned long size) -{ - processor.u.armv3v4._cache_wback_area(start, start + size); -} +#define dma_cache_wback(start, size) \ + do { processor.u.armv3v4._cache_wback_area((unsigned long)(start), \ + ((unsigned long)(start)+(size))); } while (0) -extern inline void dma_cache_wback_inv(unsigned long start, unsigned long size) -{ - processor.u.armv3v4._flush_cache_area(start, start + size, 0); -} +#define dma_cache_wback_inv(start, size) \ + do { processor.u.armv3v4._flush_cache_area((unsigned long)(start), \ + ((unsigned long)(start)+(size)), 0); } while (0) diff --git a/include/asm-arm/proc-armv/mm-init.h b/include/asm-arm/proc-armv/mm-init.h index a3f5c327f..a07e9a50e 100644 --- a/include/asm-arm/proc-armv/mm-init.h +++ b/include/asm-arm/proc-armv/mm-init.h @@ -37,7 +37,7 @@ */ #include <asm/pgtable.h> -#define PTE_SIZE (PTRS_PER_PTE * 4) +#define PTE_SIZE (PTRS_PER_PTE * BYTES_PER_PTR) extern unsigned long setup_io_pagetables(unsigned long start_mem); @@ -79,7 +79,7 @@ static inline void alloc_init_page(unsigned long *mem, unsigned long virt, unsigned long phys, int domain, int prot) { pgd_t *pgdp; - pmd_t *pmdp, pmd; + pmd_t *pmdp; pte_t *ptep; pgdp = pgd_offset_k(virt); @@ -92,46 +92,41 @@ alloc_init_page(unsigned long *mem, unsigned long virt, unsigned long phys, int ptep = (pte_t *)memory; memzero(ptep, PTE_SIZE); + memory += PTE_SIZE; - pmd_val(pmd) = __virt_to_phys(memory) | PMD_TYPE_TABLE | PMD_DOMAIN(domain); - set_pmd(pmdp, pmd); + ptep = (pte_t *)memory; + memzero(ptep, PTE_SIZE); + + set_pmd(pmdp, __mk_pmd(ptep, PMD_TYPE_TABLE | PMD_DOMAIN(domain))); *mem = memory + PTE_SIZE; } ptep = pte_offset(pmdp, virt); - pte_val(*ptep) = phys | prot | PTE_TYPE_SMALL; + set_pte(ptep, mk_pte_phys(phys, __pgprot(prot))); } static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem) { - unsigned long address; - - /* - * map in zero page - */ - alloc_init_page(&start_mem, 0, __virt_to_phys(PAGE_OFFSET), DOMAIN_USER, PTE_CACHEABLE); - - /* - * ensure no mappings in user space - */ - for (address = PGDIR_SIZE; address < PAGE_OFFSET; address += PGDIR_SIZE) - free_init_section(address); - - /* - * map in physical ram & kernel - */ - for (address = PAGE_OFFSET; address < end_mem; address += PGDIR_SIZE) - alloc_init_section(&start_mem, address, __virt_to_phys(address), DOMAIN_KERNEL, - PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE | PMD_SECT_AP_WRITE); - - /* - * unmap everything else - */ - for (address = end_mem; address; address += PGDIR_SIZE) - free_init_section(address); + unsigned long address = 0; + + do { + if (address >= PAGE_OFFSET && address < end_mem) + /* + * map in physical ram & kernel + */ + alloc_init_section(&start_mem, address, __virt_to_phys(address), DOMAIN_KERNEL, + PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE | PMD_SECT_AP_WRITE); + else + /* + * unmap everything else + */ + free_init_section(address); + + address += PGDIR_SIZE; + } while (address != 0); /* * An area to invalidate the cache @@ -144,6 +139,12 @@ setup_pagetables(unsigned long start_mem, unsigned long end_mem) */ start_mem = setup_io_pagetables(start_mem); + /* + * map in zero page + */ + alloc_init_page(&start_mem, 0, __virt_to_phys(PAGE_OFFSET), + DOMAIN_USER, L_PTE_CACHEABLE | L_PTE_YOUNG | L_PTE_PRESENT); + flush_cache_all(); return start_mem; @@ -156,9 +157,21 @@ void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) *start_mem = smem = PAGE_ALIGN(*start_mem); + /* + * Mark all of memory from the end of kernel to end of memory + */ while (smem < end_mem) { - clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); - smem += PAGE_SIZE; + clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); + smem += PAGE_SIZE; + } + + /* + * Mark memory from page 1 to start of the swapper page directory + */ + smem = PAGE_OFFSET + PAGE_SIZE; + while (smem < (unsigned long)&swapper_pg_dir) { + clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags); + smem += PAGE_SIZE; } } diff --git a/include/asm-arm/proc-armv/pgtable.h b/include/asm-arm/proc-armv/pgtable.h index f3f740373..fd93bdd29 100644 --- a/include/asm-arm/proc-armv/pgtable.h +++ b/include/asm-arm/proc-armv/pgtable.h @@ -3,14 +3,15 @@ * * Copyright (C) 1995, 1996, 1997 Russell King * - * 12-01-1997 RMK Altered flushing routines to use function pointers + * 12-Jan-1997 RMK Altered flushing routines to use function pointers * now possible to combine ARM6, ARM7 and StrongARM versions. + * 17-Apr-1999 RMK Now pass an area size to clean_cache_area and + * flush_icache_area. */ #ifndef __ASM_PROC_PGTABLE_H #define __ASM_PROC_PGTABLE_H -#include <asm/arch/mmu.h> -#include <asm/arch/processor.h> /* For TASK_SIZE */ +#include <asm/arch/memory.h> /* For TASK_SIZE */ #define LIBRARY_TEXT_START 0x0c000000 @@ -41,8 +42,23 @@ ((_vma)->vm_flags & VM_EXEC) ? 1 : 0); \ } while (0) +#define clean_cache_range(_start,_end) \ + do { \ + unsigned long _s, _sz; \ + _s = (unsigned long)_start; \ + _sz = (unsigned long)_end - _s; \ + processor.u.armv3v4._clean_cache_area(_s, _sz); \ + } while (0) + +#define clean_cache_area(_start,_size) \ + do { \ + unsigned long _s; \ + _s = (unsigned long)_start; \ + processor.u.armv3v4._clean_cache_area(_s, _size); \ + } while (0) + #define flush_icache_range(_start,_end) \ - processor.u.armv3v4._flush_icache_area((_start), (_end)) + processor.u.armv3v4._flush_icache_area((_start), (_end) - (_start)) /* * We don't have a MEMC chip... @@ -60,12 +76,6 @@ processor.u.armv3v4._flush_ram_page ((_page) & PAGE_MASK); /* - * Make the page uncacheable (must flush page beforehand). - */ -#define uncache_page(_page) \ - processor.u.armv3v4._flush_ram_page ((_page) & PAGE_MASK); - -/* * TLB flushing: * * - flush_tlb() flushes the current mm struct TLBs @@ -106,22 +116,15 @@ } while (0) /* - * Since the page tables are in cached memory, we need to flush the dirty - * data cached entries back before we flush the tlb... This is also useful - * to flush out the SWI instruction for signal handlers... + * PMD_SHIFT determines the size of the area a second-level page table can map */ -#define __flush_entry_to_ram(entry) \ - processor.u.armv3v4._flush_cache_entry((unsigned long)(entry)) - -#define __flush_pte_to_ram(entry) \ - processor.u.armv3v4._flush_cache_pte((unsigned long)(entry)) - -/* PMD_SHIFT determines the size of the area a second-level page table can map */ #define PMD_SHIFT 20 #define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) -/* PGDIR_SHIFT determines what a third-level page table entry can map */ +/* + * PGDIR_SHIFT determines what a third-level page table entry can map + */ #define PGDIR_SHIFT 20 #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) @@ -135,6 +138,7 @@ #define PTRS_PER_PGD 4096 #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) + /* Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the * physical memory until the kernel virtual memory starts. That means that @@ -147,87 +151,28 @@ #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) -/* PMD types (actually level 1 descriptor) */ -#define PMD_TYPE_MASK 0x0003 -#define PMD_TYPE_FAULT 0x0000 -#define PMD_TYPE_TABLE 0x0001 -#define PMD_TYPE_SECT 0x0002 -#define PMD_UPDATABLE 0x0010 -#define PMD_SECT_CACHEABLE 0x0008 -#define PMD_SECT_BUFFERABLE 0x0004 -#define PMD_SECT_AP_WRITE 0x0400 -#define PMD_SECT_AP_READ 0x0800 -#define PMD_DOMAIN(x) ((x) << 5) -/* PTE types (actially level 2 descriptor) */ -#define PTE_TYPE_MASK 0x0003 -#define PTE_TYPE_FAULT 0x0000 -#define PTE_TYPE_LARGE 0x0001 -#define PTE_TYPE_SMALL 0x0002 -#define PTE_AP_READ 0x0aa0 -#define PTE_AP_WRITE 0x0550 -#define PTE_CACHEABLE 0x0008 -#define PTE_BUFFERABLE 0x0004 - -/* Domains */ +/* + * Domains + */ #define DOMAIN_USER 0 #define DOMAIN_KERNEL 1 #define DOMAIN_TABLE 1 #define DOMAIN_IO 2 -#define _PAGE_CHG_MASK (0xfffff00c | PTE_TYPE_MASK) -/* - * We define the bits in the page tables as follows: - * PTE_BUFFERABLE page is dirty - * PTE_AP_WRITE page is writable - * PTE_AP_READ page is a young (unsetting this causes faults for any access) - * PTE_CACHEABLE page is readable - * - * A page will not be made writable without the dirty bit set. - * It is not legal to have a writable non-dirty page though (it breaks). - * - * A readable page is marked as being cacheable. - * Youngness is indicated by hardware read. If the page is old, - * then we will fault and make the page young again. - */ -#define _PTE_YOUNG PTE_AP_READ -#define _PTE_DIRTY PTE_BUFFERABLE -#define _PTE_READ PTE_CACHEABLE -#define _PTE_WRITE PTE_AP_WRITE -#define PAGE_NONE __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG) -#define PAGE_SHARED __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG | _PTE_READ | _PTE_WRITE) -#define PAGE_COPY __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG | _PTE_READ) -#define PAGE_READONLY __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG | _PTE_READ) -#define PAGE_KERNEL __pgprot(PTE_TYPE_SMALL | _PTE_READ | _PTE_DIRTY | _PTE_WRITE) - -#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_USER)) -#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_KERNEL)) +#undef TEST_VERIFY_AREA /* - * The arm can't do page protection for execute, and considers that the same are read. - * Also, write permissions imply read permissions. This is the closest we can get.. + * The sa110 doesn't have any external MMU info: the kernel page + * tables contain all the necessary information. */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED +extern __inline__ void update_mmu_cache(struct vm_area_struct * vma, + unsigned long address, pte_t pte) +{ +} -#undef TEST_VERIFY_AREA /* * BAD_PAGETABLE is used when we need a bogus page-table, while @@ -240,97 +185,40 @@ extern pte_t __bad_page(void); extern pte_t * __bad_pagetable(void); extern unsigned long *empty_zero_page; -#define BAD_PAGETABLE __bad_pagetable() -#define BAD_PAGE __bad_page() -#define ZERO_PAGE ((unsigned long) empty_zero_page) +#define BAD_PAGETABLE __bad_pagetable() +#define BAD_PAGE __bad_page() +#define ZERO_PAGE ((unsigned long) empty_zero_page) /* number of bits that fit into a memory pointer */ -#define BYTES_PER_PTR (sizeof(unsigned long)) -#define BITS_PER_PTR (8*BYTES_PER_PTR) +#define BYTES_PER_PTR (sizeof(unsigned long)) +#define BITS_PER_PTR (8*BYTES_PER_PTR) /* to align the pointer to a pointer address */ -#define PTR_MASK (~(sizeof(void*)-1)) +#define PTR_MASK (~(sizeof(void*)-1)) /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */ -#define SIZEOF_PTR_LOG2 2 +#define SIZEOF_PTR_LOG2 2 /* to find an entry in a page-table */ #define PAGE_PTR(address) \ ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) -/* to set the page-dir */ +/* to set the page-dir + * Note that we need to flush the cache and TLBs + * if we are affecting the current task. + */ #define SET_PAGE_DIR(tsk,pgdir) \ do { \ tsk->tss.memmap = __virt_to_phys((unsigned long)pgdir); \ - if ((tsk) == current) \ + if ((tsk) == current) { \ + flush_cache_all(); \ __asm__ __volatile__( \ "mcr%? p15, 0, %0, c2, c0, 0\n" \ : : "r" (tsk->tss.memmap)); \ + flush_tlb_all(); \ + } \ } while (0) -extern __inline__ int pte_none(pte_t pte) -{ - return !pte_val(pte); -} - -#define pte_clear(ptep) set_pte(ptep, __pte(0)) - -extern __inline__ int pte_present(pte_t pte) -{ -#if 0 - /* This is what it really does, the else - part is just to make it easier for the compiler */ - switch (pte_val(pte) & PTE_TYPE_MASK) { - case PTE_TYPE_LARGE: - case PTE_TYPE_SMALL: - return 1; - default: - return 0; - } -#else - return ((pte_val(pte) + 1) & 2); -#endif -} - -extern __inline__ int pmd_none(pmd_t pmd) -{ - return !pmd_val(pmd); -} - -#define pmd_clear(pmdp) set_pmd(pmdp, __pmd(0)) - -extern __inline__ int pmd_bad(pmd_t pmd) -{ -#if 0 - /* This is what it really does, the else - part is just to make it easier for the compiler */ - switch (pmd_val(pmd) & PMD_TYPE_MASK) { - case PMD_TYPE_FAULT: - case PMD_TYPE_TABLE: - return 0; - default: - return 1; - } -#else - return pmd_val(pmd) & 2; -#endif -} - -extern __inline__ int pmd_present(pmd_t pmd) -{ -#if 0 - /* This is what it really does, the else - part is just to make it easier for the compiler */ - switch (pmd_val(pmd) & PMD_TYPE_MASK) { - case PMD_TYPE_TABLE: - return 1; - default: - return 0; - } -#else - return ((pmd_val(pmd) + 1) & 2); -#endif -} /* * The "pgd_xxx()" functions here are trivial for a folded two-level @@ -342,231 +230,224 @@ extern __inline__ int pmd_present(pmd_t pmd) #define pgd_present(pgd) (1) #define pgd_clear(pgdp) -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -#define pte_read(pte) (1) -#define pte_exec(pte) (1) +/* to find an entry in a kernel page-table-directory */ +#define pgd_offset_k(address) pgd_offset(&init_mm, address) -extern __inline__ int pte_write(pte_t pte) +/* to find an entry in a page-table-directory */ +extern __inline__ pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) { - return pte_val(pte) & _PTE_WRITE; + return mm->pgd + (address >> PGDIR_SHIFT); } -extern __inline__ int pte_dirty(pte_t pte) -{ - return pte_val(pte) & _PTE_DIRTY; -} +extern unsigned long get_page_2k(int priority); +extern void free_page_2k(unsigned long page); -extern __inline__ int pte_young(pte_t pte) -{ - return pte_val(pte) & _PTE_YOUNG; -} +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ -extern __inline__ pte_t pte_wrprotect(pte_t pte) -{ - pte_val(pte) &= ~_PTE_WRITE; - return pte; -} +#ifndef __SMP__ +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; -extern __inline__ pte_t pte_nocache(pte_t pte) -{ - pte_val(pte) &= ~PTE_CACHEABLE; - return pte; -} +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) +#else +#error Pgtable caches have to be per-CPU, so that no locking is needed. +#endif -extern __inline__ pte_t pte_mkclean(pte_t pte) -{ - pte_val(pte) &= ~_PTE_DIRTY; - return pte; -} +extern pgd_t *get_pgd_slow(void); -extern __inline__ pte_t pte_mkold(pte_t pte) +extern __inline__ pgd_t *get_pgd_fast(void) { - pte_val(pte) &= ~_PTE_YOUNG; - return pte; + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + clean_cache_area(ret, 4); + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; } -extern __inline__ pte_t pte_mkwrite(pte_t pte) +extern __inline__ void free_pgd_fast(pgd_t *pgd) { - pte_val(pte) |= _PTE_WRITE; - return pte; + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; } -extern __inline__ pte_t pte_mkdirty(pte_t pte) +extern __inline__ void free_pgd_slow(pgd_t *pgd) { - pte_val(pte) |= _PTE_DIRTY; - return pte; + free_pages((unsigned long) pgd, 2); } -extern __inline__ pte_t pte_mkyoung(pte_t pte) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) { - pte_val(pte) |= _PTE_YOUNG; - return pte; + struct task_struct * p; + pgd_t *pgd; + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; } -/* - * The following are unable to be implemented on this MMU - */ -#if 0 -extern __inline__ pte_t pte_rdprotect(pte_t pte) +extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; + +/**************** +* PMD functions * +****************/ + +/* PMD types (actually level 1 descriptor) */ +#define PMD_TYPE_MASK 0x0003 +#define PMD_TYPE_FAULT 0x0000 +#define PMD_TYPE_TABLE 0x0001 +#define PMD_TYPE_SECT 0x0002 +#define PMD_UPDATABLE 0x0010 +#define PMD_SECT_CACHEABLE 0x0008 +#define PMD_SECT_BUFFERABLE 0x0004 +#define PMD_SECT_AP_WRITE 0x0400 +#define PMD_SECT_AP_READ 0x0800 +#define PMD_DOMAIN(x) ((x) << 5) + +#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_USER)) +#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_KERNEL)) + +#define pmd_none(pmd) (!pmd_val(pmd)) +#define pmd_clear(pmdp) set_pmd(pmdp, __pmd(0)) +#define pmd_bad(pmd) (pmd_val(pmd) & 2) +#define mk_user_pmd(ptep) __mk_pmd(ptep, _PAGE_USER_TABLE) +#define mk_kernel_pmd(ptep) __mk_pmd(ptep, _PAGE_KERNEL_TABLE) +#define set_pmd(pmdp,pmd) processor.u.armv3v4._set_pmd(pmdp,pmd) + +/* Find an entry in the second-level page table.. */ +#define pmd_offset(dir, address) ((pmd_t *)(dir)) + +extern __inline__ int pmd_present(pmd_t pmd) { - pte_val(pte) &= ~(PTE_CACHEABLE|PTE_AP_READ); - return pte; + return ((pmd_val(pmd) + 1) & 2); } -extern __inline__ pte_t pte_exprotect(pte_t pte) +/* We don't use pmd cache, so this is a dummy routine */ +extern __inline__ pmd_t *get_pmd_fast(void) { - pte_val(pte) &= ~(PTE_CACHEABLE|PTE_AP_READ); - return pte; + return (pmd_t *)0; } -extern __inline__ pte_t pte_mkread(pte_t pte) +extern __inline__ void free_pmd_fast(pmd_t *pmd) { - pte_val(pte) |= PTE_CACHEABLE; - return pte; } -extern __inline__ pte_t pte_mkexec(pte_t pte) +extern __inline__ void free_pmd_slow(pmd_t *pmd) { - pte_val(pte) |= PTE_CACHEABLE; - return pte; } -#endif + +extern void __bad_pmd(pmd_t *pmd); +extern void __bad_pmd_kernel(pmd_t *pmd); /* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. */ -extern __inline__ pte_t mk_pte(unsigned long page, pgprot_t pgprot) +extern __inline__ void pmd_free(pmd_t *pmd) { - pte_t pte; - pte_val(pte) = __virt_to_phys(page) | pgprot_val(pgprot); - return pte; } -/* This takes a physical page address that is used by the remapping functions */ -extern __inline__ pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) +extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) { - pte_t pte; - pte_val(pte) = physpage + pgprot_val(pgprot); - return pte; + return (pmd_t *) pgd; } -extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ - pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); - return pte; -} +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc -extern __inline__ void set_pte(pte_t *pteptr, pte_t pteval) +extern __inline__ pmd_t __mk_pmd(pte_t *ptep, unsigned long prot) { - *pteptr = pteval; - __flush_pte_to_ram(pteptr); -} + unsigned long pte_ptr = (unsigned long)ptep; + pmd_t pmd; -extern __inline__ unsigned long pte_page(pte_t pte) -{ - return __phys_to_virt(pte_val(pte) & PAGE_MASK); -} + pte_ptr -= PTRS_PER_PTE * BYTES_PER_PTR; -extern __inline__ pmd_t mk_user_pmd(pte_t *ptep) -{ - pmd_t pmd; - pmd_val(pmd) = __virt_to_phys((unsigned long)ptep) | _PAGE_USER_TABLE; - return pmd; -} + /* + * The pmd must be loaded with the physical + * address of the PTE table + */ + pmd_val(pmd) = __virt_to_phys(pte_ptr) | prot; -extern __inline__ pmd_t mk_kernel_pmd(pte_t *ptep) -{ - pmd_t pmd; - pmd_val(pmd) = __virt_to_phys((unsigned long)ptep) | _PAGE_KERNEL_TABLE; return pmd; } -#if 1 -#define set_pmd(pmdp,pmd) processor.u.armv3v4._set_pmd(pmdp,pmd) -#else -extern __inline__ void set_pmd(pmd_t *pmdp, pmd_t pmd) -{ - *pmdp = pmd; - __flush_pte_to_ram(pmdp); -} -#endif - extern __inline__ unsigned long pmd_page(pmd_t pmd) { - return __phys_to_virt(pmd_val(pmd) & 0xfffffc00); -} + unsigned long ptr; -/* to find an entry in a kernel page-table-directory */ -#define pgd_offset_k(address) pgd_offset(&init_mm, address) + ptr = pmd_val(pmd) & ~(PTRS_PER_PTE * BYTES_PER_PTR - 1); -/* to find an entry in a page-table-directory */ -extern __inline__ pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + (address >> PGDIR_SHIFT); + ptr += PTRS_PER_PTE * BYTES_PER_PTR; + + return __phys_to_virt(ptr); } -/* Find an entry in the second-level page table.. */ -#define pmd_offset(dir, address) ((pmd_t *)(dir)) -/* Find an entry in the third-level page table.. */ -extern __inline__ pte_t * pte_offset(pmd_t * dir, unsigned long address) -{ - return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); -} +/**************** +* PTE functions * +****************/ -extern unsigned long get_small_page(int priority); -extern void free_small_page(unsigned long page); +/* PTE types (actially level 2 descriptor) */ +#define PTE_TYPE_MASK 0x0003 +#define PTE_TYPE_FAULT 0x0000 +#define PTE_TYPE_LARGE 0x0001 +#define PTE_TYPE_SMALL 0x0002 +#define PTE_AP_READ 0x0aa0 +#define PTE_AP_WRITE 0x0550 +#define PTE_CACHEABLE 0x0008 +#define PTE_BUFFERABLE 0x0004 + +#define pte_none(pte) (!pte_val(pte)) +#define pte_clear(ptep) set_pte(ptep, __pte(0)) /* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. */ - -#ifndef __SMP__ -extern struct pgtable_cache_struct { - unsigned long *pgd_cache; - unsigned long *pte_cache; - unsigned long pgtable_cache_sz; -} quicklists; - -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) -#else -#error Pgtable caches have to be per-CPU, so that no locking is needed. -#endif - -extern pgd_t *get_pgd_slow(void); - -extern __inline__ pgd_t *get_pgd_fast(void) +extern __inline__ pte_t mk_pte(unsigned long page, pgprot_t pgprot) { - unsigned long *ret; - - if((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; + pte_t pte; + pte_val(pte) = __virt_to_phys(page) | pgprot_val(pgprot); + return pte; } -extern __inline__ void free_pgd_fast(pgd_t *pgd) +/* This takes a physical page address that is used by the remapping functions */ +extern __inline__ pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) { - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; + pte_t pte; + pte_val(pte) = physpage + pgprot_val(pgprot); + return pte; } -extern __inline__ void free_pgd_slow(pgd_t *pgd) +#define set_pte(ptep, pte) processor.u.armv3v4._set_pte(ptep,pte) + +extern __inline__ unsigned long pte_page(pte_t pte) { - free_pages((unsigned long) pgd, 2); + return __phys_to_virt(pte_val(pte) & PAGE_MASK); } extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); @@ -579,6 +460,7 @@ extern __inline__ pte_t *get_pte_fast(void) if((ret = (unsigned long *)pte_quicklist) != NULL) { pte_quicklist = (unsigned long *)(*ret); ret[0] = ret[1]; + clean_cache_area(ret, 4); pgtable_cache_size--; } return (pte_t *)ret; @@ -593,31 +475,124 @@ extern __inline__ void free_pte_fast(pte_t *pte) extern __inline__ void free_pte_slow(pte_t *pte) { - free_small_page((unsigned long)pte); + free_page_2k((unsigned long)(pte - PTRS_PER_PTE)); } -/* We don't use pmd cache, so this is a dummy routine */ -extern __inline__ pmd_t *get_pmd_fast(void) -{ - return (pmd_t *)0; -} +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) -extern __inline__ void free_pmd_fast(pmd_t *pmd) +/*############################################################################### + * New PageTableEntry stuff... + */ +/* We now keep two sets of ptes - the physical and the linux version. + * This gives us many advantages, and allows us greater flexibility. + * + * The Linux pte's contain: + * bit meaning + * 0 page present + * 1 young + * 2 bufferable - matches physical pte + * 3 cacheable - matches physical pte + * 4 user + * 5 write + * 6 execute + * 7 dirty + * 8-11 unused + * 12-31 virtual page address + * + * These are stored at the pte pointer; the physical PTE is at -1024bytes + */ +#define L_PTE_PRESENT (1 << 0) +#define L_PTE_YOUNG (1 << 1) +#define L_PTE_BUFFERABLE (1 << 2) +#define L_PTE_CACHEABLE (1 << 3) +#define L_PTE_USER (1 << 4) +#define L_PTE_WRITE (1 << 5) +#define L_PTE_EXEC (1 << 6) +#define L_PTE_DIRTY (1 << 7) + +/* + * The following macros handle the cache and bufferable bits... + */ +#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG +#define _L_PTE_READ L_PTE_USER | L_PTE_CACHEABLE +#define _L_PTE_EXEC _L_PTE_READ | L_PTE_EXEC + +#define PAGE_NONE __pgprot(_L_PTE_DEFAULT) +#define PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE) +#define PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE | L_PTE_WRITE) +#define PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) +#define PAGE_KERNEL __pgprot(_L_PTE_DEFAULT | L_PTE_CACHEABLE | L_PTE_BUFFERABLE | L_PTE_DIRTY | L_PTE_WRITE) + +#define _PAGE_CHG_MASK (PAGE_MASK | L_PTE_DIRTY | L_PTE_YOUNG) + +/* + * The table below defines the page protection levels that we insert into our + * Linux page table version. These get translated into the best that the + * architecture can perform. Note that on most ARM hardware: + * 1) We cannot do execute protection + * 2) If we could do execute protection, then read is implied + * 3) write implies read permissions + */ +#define __P000 PAGE_NONE +#define __P001 PAGE_READONLY +#define __P010 PAGE_COPY +#define __P011 PAGE_COPY +#define __P100 PAGE_READONLY +#define __P101 PAGE_READONLY +#define __P110 PAGE_COPY +#define __P111 PAGE_COPY + +#define __S000 PAGE_NONE +#define __S001 PAGE_READONLY +#define __S010 PAGE_SHARED +#define __S011 PAGE_SHARED +#define __S100 PAGE_READONLY +#define __S101 PAGE_READONLY +#define __S110 PAGE_SHARED +#define __S111 PAGE_SHARED + + + +#define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) + +/* + * The following only work if pte_present() is true. + * Undefined behaviour if not.. + */ +#define pte_read(pte) (pte_val(pte) & L_PTE_USER) +#define pte_write(pte) (pte_val(pte) & L_PTE_WRITE) +#define pte_exec(pte) (pte_val(pte) & L_PTE_EXEC) +#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) +#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) + +#define PTE_BIT_FUNC(fn,op) \ +extern inline pte_t fn##(pte_t pte) { pte_val(pte) op##; return pte; } + +//PTE_BIT_FUNC(pte_rdprotect, &= ~L_PTE_USER); +PTE_BIT_FUNC(pte_wrprotect, &= ~L_PTE_WRITE); +PTE_BIT_FUNC(pte_exprotect, &= ~L_PTE_EXEC); +PTE_BIT_FUNC(pte_mkclean, &= ~L_PTE_DIRTY); +PTE_BIT_FUNC(pte_mkold, &= ~L_PTE_YOUNG); +//PTE_BIT_FUNC(pte_mkread, |= L_PTE_USER); +PTE_BIT_FUNC(pte_mkwrite, |= L_PTE_WRITE); +PTE_BIT_FUNC(pte_mkexec, |= L_PTE_EXEC); +PTE_BIT_FUNC(pte_mkdirty, |= L_PTE_DIRTY); +PTE_BIT_FUNC(pte_mkyoung, |= L_PTE_YOUNG); +PTE_BIT_FUNC(pte_nocache, &= ~L_PTE_CACHEABLE); + +extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) { + pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); + return pte; } -extern __inline__ void free_pmd_slow(pmd_t *pmd) +/* Find an entry in the third-level page table.. */ +extern __inline__ pte_t * pte_offset(pmd_t * dir, unsigned long address) { + return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); } -extern void __bad_pmd(pmd_t *pmd); -extern void __bad_pmd_kernel(pmd_t *pmd); - -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) -#define pgd_free(pgd) free_pgd_fast(pgd) -#define pgd_alloc() get_pgd_fast() - extern __inline__ pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) { address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); @@ -655,49 +630,6 @@ extern __inline__ pte_t * pte_alloc(pmd_t * pmd, unsigned long address) return (pte_t *) pmd_page(*pmd) + address; } -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern __inline__ void pmd_free(pmd_t *pmd) -{ -} - -extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -#define pmd_free_kernel pmd_free -#define pmd_alloc_kernel pmd_alloc - -extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -} - -extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; - -/* - * The sa110 doesn't have any external MMU info: the kernel page - * tables contain all the necessary information. - */ -extern __inline__ void update_mmu_cache(struct vm_area_struct * vma, - unsigned long address, pte_t pte) -{ -} - #define SWP_TYPE(entry) (((entry) >> 2) & 0x7f) #define SWP_OFFSET(entry) ((entry) >> 9) #define SWP_ENTRY(type,offset) (((type) << 2) | ((offset) << 9)) diff --git a/include/asm-arm/proc-armv/processor.h b/include/asm-arm/proc-armv/processor.h index 88b277ea7..7186039f9 100644 --- a/include/asm-arm/proc-armv/processor.h +++ b/include/asm-arm/proc-armv/processor.h @@ -12,8 +12,6 @@ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H -#ifdef __KERNEL__ - #define KERNEL_STACK_SIZE PAGE_SIZE struct context_save_struct { @@ -28,56 +26,18 @@ struct context_save_struct { unsigned long pc; }; -#define EXTRA_THREAD_STRUCT \ - struct context_save_struct *save; \ - unsigned long memmap; +#define INIT_CSS (struct context_save_struct){ SVC_MODE, 0, 0, 0, 0, 0, 0, 0, 0 } -#define EXTRA_THREAD_STRUCT_INIT \ - 0, \ - ((unsigned long) swapper_pg_dir) - PAGE_OFFSET - -DECLARE_THREAD_STRUCT; - -/* - * Return saved PC of a blocked thread. - */ -extern __inline__ unsigned long thread_saved_pc (struct thread_struct *t) -{ - if (t->save) - return t->save->pc; - else - return 0; -} - -extern __inline__ unsigned long get_css_fp (struct thread_struct *t) -{ - if (t->save) - return t->save->fp; - else - return 0; -} - -asmlinkage void ret_from_sys_call(void) __asm__ ("ret_from_sys_call"); - -extern __inline__ void copy_thread_css (struct context_save_struct *save) -{ - save->cpsr = SVC_MODE; - save->r4 = - save->r5 = - save->r6 = - save->r7 = - save->r8 = - save->r9 = - save->fp = 0; - save->pc = (unsigned long) ret_from_sys_call; -} +#define EXTRA_THREAD_STRUCT +#define EXTRA_THREAD_STRUCT_INIT +#define SWAPPER_PG_DIR (((unsigned long)swapper_pg_dir) - PAGE_OFFSET) #define start_thread(regs,pc,sp) \ ({ \ unsigned long *stack = (unsigned long *)sp; \ set_fs(USER_DS); \ memzero(regs->uregs, sizeof(regs->uregs)); \ - if (current->personality == PER_LINUX_32BIT) \ + if (current->personality & ADDR_LIMIT_32BIT) \ regs->ARM_cpsr = USR_MODE; \ else \ regs->ARM_cpsr = USR26_MODE; \ @@ -92,10 +52,7 @@ extern __inline__ void copy_thread_css (struct context_save_struct *save) /* * NOTE! The task struct and the stack go together */ -#define alloc_task_struct() \ - ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) -#define free_task_struct(p) free_pages((unsigned long)(p),1) - -#endif +#define ll_alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) +#define ll_free_task_struct(p) free_pages((unsigned long)(p),1) #endif diff --git a/include/asm-arm/proc-armv/ptrace.h b/include/asm-arm/proc-armv/ptrace.h index 213c17ce7..b24305bd4 100644 --- a/include/asm-arm/proc-armv/ptrace.h +++ b/include/asm-arm/proc-armv/ptrace.h @@ -52,9 +52,14 @@ struct pt_regs { #define CC_Z_BIT (1 << 30) #define CC_N_BIT (1 << 31) +#if 0 /* GCC/egcs should be able to optimise this, IMHO */ #define user_mode(regs) \ ((((regs)->ARM_cpsr & MODE_MASK) == USR_MODE) || \ (((regs)->ARM_cpsr & MODE_MASK) == USR26_MODE)) +#else +#define user_mode(regs) \ + (((regs)->ARM_cpsr & 0xf) == 0) +#endif #define processor_mode(regs) \ ((regs)->ARM_cpsr & MODE_MASK) @@ -74,8 +79,19 @@ struct pt_regs { /* Are the current registers suitable for user mode? * (used to maintain security in signal handlers) */ -#define valid_user_regs(regs) \ - (user_mode(regs) && ((regs)->ARM_sp & 3) == 0) +static inline int valid_user_regs(struct pt_regs *regs) +{ + if ((regs->ARM_cpsr & 0xf) == 0 || + (regs->ARM_cpsr & (F_BIT|I_BIT))) + return 1; + + /* + * Force CPSR to something logical... + */ + regs->ARM_cpsr &= (CC_V_BIT|CC_C_BIT|CC_Z_BIT|CC_N_BIT|0x10); + + return 0; +} #endif diff --git a/include/asm-arm/proc-armv/semaphore.h b/include/asm-arm/proc-armv/semaphore.h index 3da31f536..52098bc5c 100644 --- a/include/asm-arm/proc-armv/semaphore.h +++ b/include/asm-arm/proc-armv/semaphore.h @@ -60,6 +60,32 @@ extern inline int down_interruptible (struct semaphore * sem) return temp; } +extern inline int down_trylock(struct semaphore *sem) +{ + unsigned int cpsr, temp; + + __asm__ __volatile__ (" + @ atomic down try lock operation + mrs %0, cpsr + orr %1, %0, #128 @ disable IRQs + bic %0, %0, #0x80000000 @ clear N + msr cpsr, %1 + ldr %1, [%2] + subs %1, %1, #1 + orrmi %0, %0, #0x80000000 @ set N + str %1, [%2] + msr cpsr, %0 + movmi r0, %2 + movpl r0, #0 + blmi " SYMBOL_NAME_STR(__down_trylock_failed) " + mov %1, r0" + : "=&r" (cpsr), "=&r" (temp) + : "r" (sem) + : "r0", "lr", "cc"); + + return temp; +} + /* * Note! This is subtle. We jump to wake people up only if * the semaphore was negative (== somebody was waiting on it). diff --git a/include/asm-arm/proc-armv/uaccess.h b/include/asm-arm/proc-armv/uaccess.h index a8dce6739..a015a0738 100644 --- a/include/asm-arm/proc-armv/uaccess.h +++ b/include/asm-arm/proc-armv/uaccess.h @@ -133,6 +133,7 @@ extern __inline__ void set_fs (mm_segment_t fs) " .section .fixup,\"ax\"\n" \ " .align 2\n" \ "3: mvn %0, %3\n" \ + " mov %1, #0\n" \ " b 2b\n" \ " .previous\n" \ " .section __ex_table,\"a\"\n" \ @@ -153,6 +154,7 @@ extern __inline__ void set_fs (mm_segment_t fs) " .section .fixup,\"ax\"\n" \ " .align 2\n" \ "4: mvn %0, %5\n" \ + " mov %1, #0\n" \ " b 3b\n" \ " .previous\n" \ " .section __ex_table,\"a\"\n" \ @@ -173,6 +175,7 @@ extern __inline__ void set_fs (mm_segment_t fs) " .section .fixup,\"ax\"\n" \ " .align 2\n" \ "3: mvn %0, %3\n" \ + " mov %1, #0\n" \ " b 2b\n" \ " .previous\n" \ " .section __ex_table,\"a\"\n" \ diff --git a/include/asm-arm/proc-fns.h b/include/asm-arm/proc-fns.h index e3b35c9f2..81873a58c 100644 --- a/include/asm-arm/proc-fns.h +++ b/include/asm-arm/proc-fns.h @@ -9,6 +9,10 @@ #include <asm/page.h> #ifdef __KERNEL__ + +/* forward-decare task_struct */ +struct task_struct; + /* * Don't change this structure */ @@ -18,7 +22,7 @@ extern struct processor { * * flush caches for task switch */ - void (*_switch_to)(void *prev, void *next); + struct task_struct *(*_switch_to)(struct task_struct *prev, struct task_struct *next); /* * get data abort address/flags */ @@ -54,10 +58,10 @@ extern struct processor { */ void (*_flush_cache_entry)(unsigned long address); /* - * flush a virtual address used for a page table - * note D-cache only! + * clean a virtual address range from the + * D-cache without flushing the cache. */ - void (*_flush_cache_pte)(unsigned long address); + void (*_clean_cache_area)(unsigned long start, unsigned long size); /* * flush a page to RAM */ @@ -76,13 +80,17 @@ extern struct processor { */ void (*_set_pmd)(pmd_t *pmdp, pmd_t pmd); /* + * Set a PTE + */ + void (*_set_pte)(pte_t *ptep, pte_t pte); + /* * Special stuff for a reset */ unsigned long (*reset)(void); /* * flush an icached page */ - void (*_flush_icache_area)(unsigned long start, unsigned long end); + void (*_flush_icache_area)(unsigned long start, unsigned long size); /* * write back dirty cached data */ diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index f4c687089..a59e441a1 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -7,12 +7,14 @@ #ifndef __ASM_ARM_PROCESSOR_H #define __ASM_ARM_PROCESSOR_H +#define FP_SIZE 35 + struct fp_hard_struct { - unsigned int save[140/4]; /* as yet undefined */ + unsigned int save[FP_SIZE]; /* as yet undefined */ }; struct fp_soft_struct { - unsigned int save[140/4]; /* undefined information */ + unsigned int save[FP_SIZE]; /* undefined information */ }; union fp_state { @@ -22,28 +24,59 @@ union fp_state { typedef unsigned long mm_segment_t; /* domain register */ -#define NR_DEBUGS 5 +#ifdef __KERNEL__ -#define DECLARE_THREAD_STRUCT \ -struct thread_struct { \ - unsigned long address; /* Address of fault */ \ - unsigned long trap_no; /* Trap number */ \ - unsigned long error_code; /* Error code of trap */ \ - union fp_state fpstate; /* FPE save state */ \ - unsigned long debug[NR_DEBUGS]; /* Debug/ptrace */ \ - EXTRA_THREAD_STRUCT \ -} +#include <asm/assembler.h> + +#define NR_DEBUGS 5 #include <asm/arch/processor.h> #include <asm/proc/processor.h> -#define INIT_TSS { \ - 0, \ - 0, \ - 0, \ - { { { 0, }, }, }, \ - { 0, }, \ - EXTRA_THREAD_STRUCT_INIT \ +struct thread_struct { + unsigned long address; /* Address of fault */ + unsigned long trap_no; /* Trap number */ + unsigned long error_code; /* Error code of trap */ + union fp_state fpstate; /* FPE save state */ + unsigned long debug[NR_DEBUGS]; /* Debug/ptrace */ + struct context_save_struct *save; /* context save */ + unsigned long memmap; /* page tables */ + EXTRA_THREAD_STRUCT +}; + +#define INIT_MMAP \ +{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } + +#define INIT_TSS { \ + 0, \ + 0, \ + 0, \ + { { { 0, }, }, }, \ + { 0, }, \ + (struct context_save_struct *)0, \ + SWAPPER_PG_DIR \ + EXTRA_THREAD_STRUCT_INIT \ +} + +/* + * Return saved PC of a blocked thread. + */ +extern __inline__ unsigned long thread_saved_pc(struct thread_struct *t) +{ + return t->save ? t->save->pc & ~PCMASK : 0; +} + +extern __inline__ unsigned long get_css_fp(struct thread_struct *t) +{ + return t->save ? t->save->fp : 0; +} + +asmlinkage void ret_from_sys_call(void) __asm__("ret_from_sys_call"); + +extern __inline__ void init_thread_css(struct context_save_struct *save) +{ + *save = INIT_CSS; + save->pc |= (unsigned long)ret_from_sys_call; } /* Forward declaration, a strange C thing */ @@ -57,7 +90,12 @@ extern void release_thread(struct task_struct *); #define release_segments(mm) do { } while (0) #define forget_segments() do { } while (0) +extern struct task_struct *alloc_task_struct(void); +extern void free_task_struct(struct task_struct *); + #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) +#endif + #endif /* __ASM_ARM_PROCESSOR_H */ diff --git a/include/asm-arm/semaphore-helper.h b/include/asm-arm/semaphore-helper.h new file mode 100644 index 000000000..1d7f1987e --- /dev/null +++ b/include/asm-arm/semaphore-helper.h @@ -0,0 +1,84 @@ +#ifndef ASMARM_SEMAPHORE_HELPER_H +#define ASMARM_SEMAPHORE_HELPER_H + +/* + * These two _must_ execute atomically wrt each other. + */ +static inline void wake_one_more(struct semaphore * sem) +{ + unsigned long flags; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (atomic_read(&sem->count) <= 0) + sem->waking++; + spin_unlock_irqrestore(&semaphore_wake_lock, flags); +} + +static inline int waking_non_zero(struct semaphore *sem) +{ + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking > 0) { + sem->waking--; + ret = 1; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +/* + * waking non zero interruptible + * 1 got the lock + * 0 go to sleep + * -EINTR interrupted + * + * We must undo the sem->count down_interruptible() increment while we are + * protected by the spinlock in order to make this atomic_inc() with the + * atomic_read() in wake_one_more(), otherwise we can race. -arca + */ +static inline int waking_non_zero_interruptible(struct semaphore *sem, + struct task_struct *tsk) +{ + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking > 0) { + sem->waking--; + ret = 1; + } else if (signal_pending(tsk)) { + atomic_inc(&sem->count); + ret = -EINTR; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +/* + * waking_non_zero_try_lock: + * 1 failed to lock + * 0 got the lock + * + * We must undo the sem->count down_interruptible() increment while we are + * protected by the spinlock in order to make this atomic_inc() with the + * atomic_read() in wake_one_more(), otherwise we can race. -arca + */ +static inline int waking_non_zero_trylock(struct semaphore *sem) +{ + unsigned long flags; + int ret = 1; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking <= 0) + atomic_inc(&sem->count); + else { + sem->waking--; + ret = 0; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +#endif diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h index 287d8c263..a51b6f96e 100644 --- a/include/asm-arm/semaphore.h +++ b/include/asm-arm/semaphore.h @@ -19,50 +19,16 @@ struct semaphore { asmlinkage void __down_failed (void /* special register calling convention */); asmlinkage int __down_interruptible_failed (void /* special register calling convention */); +asmlinkage int __down_failed_trylock(void /* params in registers */); asmlinkage void __up_wakeup (void /* special register calling convention */); extern void __down(struct semaphore * sem); extern int __down_interruptible(struct semaphore * sem); +extern int __down_trylock(struct semaphore * sem); extern void __up(struct semaphore * sem); #define sema_init(sem, val) atomic_set(&((sem)->count), (val)) -/* - * These two _must_ execute atomically wrt each other. - * - * This is trivially done with load_locked/store_cond, - * but on the x86 we need an external synchronizer. - * Currently this is just the global interrupt lock, - * bah. Go for a smaller spinlock some day. - * - * (On the other hand this shouldn't be in any critical - * path, so..) - */ -static inline void wake_one_more(struct semaphore * sem) -{ - unsigned long flags; - - save_flags(flags); - cli(); - sem->waking++; - restore_flags(flags); -} - -static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) -{ - unsigned long flags; - int ret = 0; - - save_flags(flags); - cli(); - if (sem->waking > 0) { - sem->waking--; - ret = 1; - } - restore_flags(flags); - return ret; -} - #include <asm/proc/semaphore.h> #endif diff --git a/include/asm-arm/siginfo.h b/include/asm-arm/siginfo.h index 2dec6e080..c08847d32 100644 --- a/include/asm-arm/siginfo.h +++ b/include/asm-arm/siginfo.h @@ -138,7 +138,7 @@ typedef struct siginfo { */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ -#define NSIGTRAP +#define NSIGTRAP 2 /* * SIGCHLD si_codes diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 91c08d668..2874c4661 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -1,10 +1,26 @@ #ifndef __ASM_ARM_SYSTEM_H #define __ASM_ARM_SYSTEM_H +#include <linux/kernel.h> + +#ifdef __KERNEL__ + #include <linux/config.h> +#define __ebsa285_data __attribute__((__section__(".data.ebsa285"))) +#define __netwinder_data __attribute__((__section__(".data.netwinder"))) + +#ifdef CONFIG_TEXT_SECTIONS +#define __ebsa285_text __attribute__((__section__(".text.ebsa285"))) +#define __netwinder_text __attribute__((__section__(".text.netwinder"))) +#else +#define __ebsa285_text +#define __netwinder_text +#endif + /* The type of machine we're running on */ -extern unsigned int machine_type; +extern unsigned int __machine_arch_type; + #define MACH_TYPE_EBSA110 0 #define MACH_TYPE_RISCPC 1 #define MACH_TYPE_NEXUSPCI 3 @@ -12,31 +28,101 @@ extern unsigned int machine_type; #define MACH_TYPE_NETWINDER 5 #define MACH_TYPE_CATS 6 #define MACH_TYPE_TBOX 7 +#define MACH_TYPE_CO285 8 +#define MACH_TYPE_CLPS7110 9 +#define MACH_TYPE_ARCHIMEDES 10 +#define MACH_TYPE_A5K 11 + +/* + * Sort out a definition for machine_arch_type + * The rules basically are: + * 1. If one architecture is selected, then all machine_is_xxx() + * are constant. + * 2. If two or more architectures are selected, then the selected + * machine_is_xxx() are variable, and the unselected machine_is_xxx() + * are constant zero. + */ +#ifdef CONFIG_ARCH_EBSA110 +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_EBSA110 +# endif +# define machine_is_ebsa110() (machine_arch_type == MACH_TYPE_EBSA110) +#else +# define machine_is_ebsa110() (0) +#endif + +#ifdef CONFIG_ARCH_RPC +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_RISCPC +# endif +# define machine_is_riscpc() (machine_arch_type == MACH_TYPE_RISCPC) +#else +# define machine_is_riscpc() (0) +#endif #ifdef CONFIG_ARCH_EBSA285 -#define machine_is_ebsa285() (1) +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_EBSA285 +# endif +# define machine_is_ebsa285() (machine_arch_type == MACH_TYPE_EBSA285) #else -#define machine_is_ebsa285() (0) +# define machine_is_ebsa285() (0) #endif -#ifdef CONFIG_ARCH_VNC -#define machine_is_netwinder() (1) +#ifdef CONFIG_ARCH_NETWINDER +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_NETWINDER +# endif +# define machine_is_netwinder() (machine_arch_type == MACH_TYPE_NETWINDER) #else -#define machine_is_netwinder() (0) +# define machine_is_netwinder() (0) #endif -#if defined(CONFIG_CATS) -#define machine_is_cats() (machine_type == MACH_TYPE_CATS) +#ifdef CONFIG_CATS +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_CATS +# endif +# define machine_is_cats() (machine_arch_type == MACH_TYPE_CATS) #else -#define machine_is_cats() (0) +# define machine_is_cats() (0) #endif -#if 0 -#define machine_is_ebsa285() (machine_type == MACH_TYPE_EBSA285) -#define machine_is_netwinder() (machine_type == MACH_TYPE_NETWINDER) +#ifdef CONFIG_ARCH_CO285 +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_CO285 +# endif +# define machine_is_co285() (machine_arch_type == MACH_TYPE_CO285) +#else +# define machine_is_co285() (0) #endif -#include <linux/kernel.h> +#ifndef machine_arch_type +#define machine_arch_type __machine_arch_type +#endif + +/* + * task_struct isn't always declared - forward-declare it here. + */ +struct task_struct; + #include <asm/proc-fns.h> extern void arm_malalignedptr(const char *, void *, volatile void *); @@ -53,7 +139,7 @@ extern void arm_invalidptr(const char *, int); * * `next' and `prev' should be struct task_struct, but it isn't always defined */ -#define switch_to(prev,next) processor._switch_to(prev,next) +#define switch_to(prev,next,last) do { last = processor._switch_to(prev,next); } while (0) /* * Include processor dependent parts @@ -62,9 +148,12 @@ extern void arm_invalidptr(const char *, int); #include <asm/arch/system.h> #define mb() __asm__ __volatile__ ("" : : : "memory") -#define nop() __asm__ __volatile__("mov r0,r0\n\t"); +#define rmb() mb() +#define wmb() mb() +#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); extern asmlinkage void __backtrace(void); #endif +#endif diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 601af3b0a..86c0c2883 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -195,6 +195,9 @@ #define __NR_capset (__NR_SYSCALL_BASE+185) #define __NR_sigaltstack (__NR_SYSCALL_BASE+186) #define __NR_sendfile (__NR_SYSCALL_BASE+187) + /* 188 reserved */ + /* 189 reserved */ +#define __NR_vfork (__NR_SYSCALL_BASE+190) #define __sys2(x) #x #define __sys1(x) __sys2(x) @@ -364,7 +367,7 @@ static inline int close(int fd) static inline int _exit(int exitcode) { - extern int sys_exit(int); + extern int sys_exit(int) __attribute__((noreturn)); return sys_exit(exitcode); } @@ -393,37 +396,11 @@ static inline pid_t wait(int * wait_stat) static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp); /* - * This is the mechanism for creating a new kernel thread. - * - * NOTE! Only a kernel-only process(ie the swapper or direct descendants - * who haven't done an "execve()") should use this: it will work within - * a system call from a "real" process, but the process memory space will - * not be free'd until both the parent and the child have exited. + * Create a new kernel thread */ -static inline pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - long retval; - - __asm__ __volatile__(" - mov r0,%1 - mov r1,%2 - "__syscall(clone)" - teq r0, #0 - bne 1f - mov r0,%4 - mov lr, pc - mov pc, %3 - "__syscall(exit)" -1: mov %0,r0" - : "=r" (retval) - : "Ir" (flags | CLONE_VM), "Ir" (NULL), "r" (fn), "Ir" (arg) - : "r0","r1","r2","r3","lr"); - - return retval; -} +extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); #endif - #endif /* __ASM_ARM_UNISTD_H */ diff --git a/include/asm-arm/vga.h b/include/asm-arm/vga.h index 6a9278df9..19c454396 100644 --- a/include/asm-arm/vga.h +++ b/include/asm-arm/vga.h @@ -1,9 +1,10 @@ #ifndef ASMARM_VGA_H #define ASMARM_VGA_H +#include <asm/hardware.h> #include <asm/io.h> -#define VGA_MAP_MEM(x) (0xe0000000 + (x)) +#define VGA_MAP_MEM(x) (PCIMEM_BASE + (x)) #define vga_readb(x) (*(x)) #define vga_writeb(x,y) (*(y) = (x)) diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 09f25dc78..08df0f278 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -46,7 +46,7 @@ extern __inline__ void set_bit(int nr, volatile void * addr) __asm__ __volatile__( LOCK_PREFIX "btsl %1,%0" :"=m" (ADDR) - :"ir" (nr)); + :"Ir" (nr)); } extern __inline__ void clear_bit(int nr, volatile void * addr) @@ -54,7 +54,7 @@ extern __inline__ void clear_bit(int nr, volatile void * addr) __asm__ __volatile__( LOCK_PREFIX "btrl %1,%0" :"=m" (ADDR) - :"ir" (nr)); + :"Ir" (nr)); } extern __inline__ void change_bit(int nr, volatile void * addr) @@ -62,7 +62,7 @@ extern __inline__ void change_bit(int nr, volatile void * addr) __asm__ __volatile__( LOCK_PREFIX "btcl %1,%0" :"=m" (ADDR) - :"ir" (nr)); + :"Ir" (nr)); } extern __inline__ int test_and_set_bit(int nr, volatile void * addr) @@ -72,7 +72,7 @@ extern __inline__ int test_and_set_bit(int nr, volatile void * addr) __asm__ __volatile__( LOCK_PREFIX "btsl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"ir" (nr)); + :"Ir" (nr)); return oldbit; } @@ -83,7 +83,7 @@ extern __inline__ int test_and_clear_bit(int nr, volatile void * addr) __asm__ __volatile__( LOCK_PREFIX "btrl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"ir" (nr)); + :"Ir" (nr)); return oldbit; } @@ -94,7 +94,7 @@ extern __inline__ int test_and_change_bit(int nr, volatile void * addr) __asm__ __volatile__( LOCK_PREFIX "btcl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"ir" (nr)); + :"Ir" (nr)); return oldbit; } @@ -113,7 +113,7 @@ extern __inline__ int __test_bit(int nr, volatile void * addr) __asm__ __volatile__( "btl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit) - :"m" (ADDR),"ir" (nr)); + :"m" (ADDR),"Ir" (nr)); return oldbit; } diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index c9ca53c66..ebd9a4f1a 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -19,6 +19,7 @@ #include <linux/config.h> #include <asm/processor.h> +#include <asm/msr.h> #define CONFIG_BUGi386 @@ -27,6 +28,11 @@ __initfunc(static void no_halt(char *s, int *ints)) boot_cpu_data.hlt_works_ok = 0; } +__initfunc(static void mca_pentium(char *s, int *ints)) +{ + mca_pentium_flag = 1; +} + __initfunc(static void no_387(char *s, int *ints)) { boot_cpu_data.hard_math = 0; @@ -61,6 +67,31 @@ __initfunc(static void check_fpu(void)) #endif return; } + if (mca_pentium_flag) { + /* The IBM Model 95 machines with pentiums lock up on + * fpu test, so we avoid it. All pentiums have inbuilt + * FPU and thus should use exception 16. We still do + * the FDIV test, although I doubt there where ever any + * MCA boxes built with non-FDIV-bug cpus. + */ + __asm__("fninit\n\t" + "fldl %1\n\t" + "fdivl %2\n\t" + "fmull %2\n\t" + "fldl %1\n\t" + "fsubp %%st,%%st(1)\n\t" + "fistpl %0\n\t" + "fwait\n\t" + "fninit" + : "=m" (*&boot_cpu_data.fdiv_bug) + : "m" (*&x), "m" (*&y)); + printk("mca-pentium specified, avoiding FPU coupling test... "); + if (!boot_cpu_data.fdiv_bug) + printk("??? No FDIV bug? Lucky you...\n"); + else + printk("detected FDIV bug though.\n"); + return; + } /* * check if exception 16 works correctly.. This is truly evil * code: it disables the high 8 interrupts to make sure that @@ -173,10 +204,10 @@ __initfunc(static void check_amd_k6(void)) n = K6_BUG_LOOP; f_vide = vide; - __asm__ ("rdtsc" : "=a" (d)); + rdtscl(d); while (n--) f_vide(); - __asm__ ("rdtsc" : "=a" (d2)); + rdtscl(d2); d = d2-d; /* Knock these two lines out if it debugs out ok */ @@ -246,6 +277,7 @@ __initfunc(static void check_cx686_cpuid(void)) ((Cx86_dir0_msb == 5) || (Cx86_dir0_msb == 3))) { int eax, dummy; unsigned char ccr3, ccr4; + __u32 old_cap; cli(); ccr3 = getCx86(CX86_CCR3); @@ -257,8 +289,11 @@ __initfunc(static void check_cx686_cpuid(void)) /* we have up to level 1 available on the Cx6x86(L|MX) */ boot_cpu_data.cpuid_level = 1; + /* Need to preserve some externally computed capabilities */ + old_cap = boot_cpu_data.x86_capability & X86_FEATURE_MTRR; cpuid(1, &eax, &dummy, &dummy, &boot_cpu_data.x86_capability); + boot_cpu_data.x86_capability |= old_cap; boot_cpu_data.x86 = (eax >> 8) & 15; /* @@ -314,6 +349,24 @@ __initfunc(static void check_cyrix_cpu(void)) } /* + * In setup.c's cyrix_model() we have set the boot_cpu_data.coma_bug + * on certain processors that we know contain this bug and now we + * enable the workaround for it. + */ + +__initfunc(static void check_cyrix_coma(void)) +{ + if (boot_cpu_data.coma_bug) { + unsigned char ccr1; + cli(); + ccr1 = getCx86 (CX86_CCR1); + setCx86 (CX86_CCR1, ccr1 | 0x10); + sti(); + printk("Cyrix processor with \"coma bug\" found, workaround enabled\n"); + } +} + +/* * Check wether we are able to run this kernel safely on SMP. * * - In order to run on a i386, we need to be compiled for i386 @@ -371,5 +424,6 @@ __initfunc(static void check_bugs(void)) check_popad(); check_amd_k6(); check_pentium_f00f(); + check_cyrix_coma(); system_utsname.machine[1] = '0' + boot_cpu_data.x86; } diff --git a/include/asm-i386/cache.h b/include/asm-i386/cache.h index 50c1dbe8f..cea6c8540 100644 --- a/include/asm-i386/cache.h +++ b/include/asm-i386/cache.h @@ -13,4 +13,6 @@ #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) +#define SMP_CACHE_BYTES L1_CACHE_BYTES + #endif diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h index 3d9a7c46c..436ad1d21 100644 --- a/include/asm-i386/irq.h +++ b/include/asm-i386/irq.h @@ -13,11 +13,15 @@ #define TIMER_IRQ 0 /* - * 16 XT IRQ's, 8 potential APIC interrupt sources. - * Right now the APIC is only used for SMP, but this - * may change. + * 16 8259A IRQ's, 240 potential APIC interrupt sources. + * Right now the APIC is mostly only used for SMP. + * 256 vectors is an architectural limit. (we can have + * more than 256 devices theoretically, but they will + * have to use shared interrupts) + * Since vectors 0x00-0x1f are used/reserved for the CPU, + * the usable vector space is 0x20-0xff (224 vectors) */ -#define NR_IRQS 64 +#define NR_IRQS 224 static __inline__ int irq_cannonicalize(int irq) { @@ -25,6 +29,7 @@ static __inline__ int irq_cannonicalize(int irq) } extern void disable_irq(unsigned int); +extern void disable_irq_nosync(unsigned int); extern void enable_irq(unsigned int); #endif /* _ASM_IRQ_H */ diff --git a/include/asm-i386/keyboard.h b/include/asm-i386/keyboard.h index fd3009724..2a7effa3c 100644 --- a/include/asm-i386/keyboard.h +++ b/include/asm-i386/keyboard.h @@ -3,7 +3,7 @@ * * Created 3 Nov 1996 by Geert Uytterhoeven * - * $Id: keyboard.h,v 1.7 1999/02/01 15:51:16 ralf Exp $ + * $Id: keyboard.h,v 1.8 1999/06/10 08:02:38 ralf Exp $ */ /* @@ -23,7 +23,6 @@ extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); -extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pckbd_unexpected_up(unsigned char keycode); @@ -33,7 +32,6 @@ extern unsigned char pckbd_sysrq_xlate[128]; #define kbd_setkeycode pckbd_setkeycode #define kbd_getkeycode pckbd_getkeycode -#define kbd_pretranslate pckbd_pretranslate #define kbd_translate pckbd_translate #define kbd_unexpected_up pckbd_unexpected_up #define kbd_leds pckbd_leds diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h new file mode 100644 index 000000000..1ed8ea851 --- /dev/null +++ b/include/asm-i386/msr.h @@ -0,0 +1,30 @@ +/* + * Access to machine-specific registers (available on 586 and better only) + * Note: the rd* operations modify the parameters directly (without using + * pointer indirection), this allows gcc to optimize better + */ + +#define rdmsr(msr,val1,val2) \ + __asm__ __volatile__("rdmsr" \ + : "=a" (val1), "=d" (val2) \ + : "c" (msr)) + +#define wrmsr(msr,val1,val2) \ + __asm__ __volatile__("wrmsr" \ + : /* no outputs */ \ + : "c" (msr), "a" (val1), "d" (val2)) + +#define rdtsc(low,high) \ + __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) + +#define rdtscl(low) \ + __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") + +#define rdtscll(val) \ + __asm__ __volatile__ ("rdtsc" : "=A" (val)) + +#define rdpmc(counter,low,high) \ + __asm__ __volatile__("rdpmc" \ + : "=a" (low), "=d" (high) \ + : "c" (counter)) + diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h index 5b1e8470c..e6d130c9a 100644 --- a/include/asm-i386/mtrr.h +++ b/include/asm-i386/mtrr.h @@ -1,6 +1,6 @@ /* Generic MTRR (Memory Type Range Register) ioctls. - Copyright (C) 1997-1998 Richard Gooch + Copyright (C) 1997-1999 Richard Gooch This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -44,10 +44,11 @@ struct mtrr_gentry }; /* These are the various ioctls */ -#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry) -#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry) -#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry) +#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry) +#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry) +#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry) #define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry) +#define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry) /* These are the region types */ #define MTRR_TYPE_UNCACHABLE 0 @@ -75,7 +76,7 @@ static char *mtrr_strings[MTRR_NUM_TYPES] = #ifdef __KERNEL__ /* The following functions are for use by other drivers */ -# if defined(CONFIG_MTRR) || defined(CONFIG_MTRR_MODULE) +# ifdef CONFIG_MTRR extern int mtrr_add (unsigned long base, unsigned long size, unsigned int type, char increment); extern int mtrr_del (int reg, unsigned long base, unsigned long size); diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 257a0e99d..bd631d244 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -220,7 +220,7 @@ static inline void flush_tlb_range(struct mm_struct *mm, #define _PAGE_PRESENT 0x001 #define _PAGE_RW 0x002 #define _PAGE_USER 0x004 -#define _PAGE_WT 0x008 +#define _PAGE_PWT 0x008 #define _PAGE_PCD 0x010 #define _PAGE_ACCESSED 0x020 #define _PAGE_DIRTY 0x040 @@ -594,5 +594,6 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (0) +#define kern_addr_valid(addr) (1) #endif /* _I386_PAGE_H */ diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 9dd4f9df2..25ef571e3 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -35,6 +35,7 @@ struct cpuinfo_x86 { call */ int fdiv_bug; int f00f_bug; + int coma_bug; unsigned long loops_per_sec; unsigned long *pgd_quick; unsigned long *pte_quick; @@ -119,12 +120,17 @@ extern inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) /* * Cyrix CPU configuration register indexes */ +#define CX86_CCR0 0xc0 +#define CX86_CCR1 0xc1 #define CX86_CCR2 0xc2 #define CX86_CCR3 0xc3 #define CX86_CCR4 0xe8 #define CX86_CCR5 0xe9 +#define CX86_CCR6 0xea #define CX86_DIR0 0xfe #define CX86_DIR1 0xff +#define CX86_ARR_BASE 0xc4 +#define CX86_RCR_BASE 0xdc /* * Cyrix CPU indexed register access macros @@ -148,6 +154,7 @@ others may find it useful. */ extern unsigned int machine_id; extern unsigned int machine_submodel_id; extern unsigned int BIOS_revision; +extern unsigned int mca_pentium_flag; /* * User space process size: 3GB (default). diff --git a/include/asm-i386/semaphore-helper.h b/include/asm-i386/semaphore-helper.h new file mode 100644 index 000000000..c8636da0c --- /dev/null +++ b/include/asm-i386/semaphore-helper.h @@ -0,0 +1,94 @@ +#ifndef _I386_SEMAPHORE_HELPER_H +#define _I386_SEMAPHORE_HELPER_H + +/* + * SMP- and interrupt-safe semaphores helper functions. + * + * (C) Copyright 1996 Linus Torvalds + * (C) Copyright 1999 Andrea Arcangeli + */ + +/* + * These two _must_ execute atomically wrt each other. + * + * This is trivially done with load_locked/store_cond, + * but on the x86 we need an external synchronizer. + */ +static inline void wake_one_more(struct semaphore * sem) +{ + unsigned long flags; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (atomic_read(&sem->count) <= 0) + sem->waking++; + spin_unlock_irqrestore(&semaphore_wake_lock, flags); +} + +static inline int waking_non_zero(struct semaphore *sem) +{ + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking > 0) { + sem->waking--; + ret = 1; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +/* + * waking_non_zero_interruptible: + * 1 got the lock + * 0 go to sleep + * -EINTR interrupted + * + * We must undo the sem->count down_interruptible() increment while we are + * protected by the spinlock in order to make atomic this atomic_inc() with the + * atomic_read() in wake_one_more(), otherwise we can race. -arca + */ +static inline int waking_non_zero_interruptible(struct semaphore *sem, + struct task_struct *tsk) +{ + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking > 0) { + sem->waking--; + ret = 1; + } else if (signal_pending(tsk)) { + atomic_inc(&sem->count); + ret = -EINTR; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +/* + * waking_non_zero_trylock: + * 1 failed to lock + * 0 got the lock + * + * We must undo the sem->count down_trylock() increment while we are + * protected by the spinlock in order to make atomic this atomic_inc() with the + * atomic_read() in wake_one_more(), otherwise we can race. -arca + */ +static inline int waking_non_zero_trylock(struct semaphore *sem) +{ + unsigned long flags; + int ret = 1; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking <= 0) + atomic_inc(&sem->count); + else { + sem->waking--; + ret = 0; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +#endif diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h index d78970da0..ccf69385c 100644 --- a/include/asm-i386/semaphore.h +++ b/include/asm-i386/semaphore.h @@ -12,6 +12,11 @@ * the original code and to make semaphore waits * interruptible so that processes waiting on * semaphores can be killed. + * Modified 1999-02-14 by Andrea Arcangeli, split the sched.c helper + * functions in asm/sempahore-helper.h while fixing a + * potential and subtle race discovered by Ulrich Schmid + * in down_interruptible(). Since I started to play here I + * also implemented the `trylock' semaphore operation. * * If you would like to see an analysis of this implementation, please * ftp to gcom.com and download the file @@ -23,56 +28,23 @@ #include <asm/atomic.h> #include <asm/spinlock.h> -/* - * Semaphores are recursive: we allow the holder process - * to recursively do down() operations on a semaphore that - * the process already owns. In order to do that, we need - * to keep a semaphore-local copy of the owner and the - * "depth of ownership". - * - * NOTE! Nasty memory ordering rules: - * - "owner" and "owner_count" may only be modified once you hold the - * lock. - * - "owner_count" must be written _after_ modifying owner, and - * must be read _before_ reading owner. There must be appropriate - * write and read barriers to enforce this. - * - * On an x86, writes are always ordered, so the only enformcement - * necessary is to make sure that the owner_depth is written after - * the owner value in program order. - * - * For read ordering guarantees, the semaphore wake_lock spinlock - * is already giving us ordering guarantees. - * - * Other (saner) architectures would use "wmb()" and "rmb()" to - * do this in a more obvious manner. - */ struct semaphore { atomic_t count; - unsigned long owner, owner_depth; int waking; struct wait_queue * wait; }; -/* - * Because we want the non-contention case to be - * fast, we save the stack pointer into the "owner" - * field, and to get the true task pointer we have - * to do the bit masking. That moves the masking - * operation into the slow path. - */ -#define semaphore_owner(sem) \ - ((struct task_struct *)((2*PAGE_MASK) & (sem)->owner)) - -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, 0, 0, NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, 1, 0, NULL }) +#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, NULL }) +#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, NULL }) asmlinkage void __down_failed(void /* special register calling convention */); asmlinkage int __down_failed_interruptible(void /* params in registers */); +asmlinkage int __down_failed_trylock(void /* params in registers */); asmlinkage void __up_wakeup(void /* special register calling convention */); asmlinkage void __down(struct semaphore * sem); asmlinkage int __down_interruptible(struct semaphore * sem); +asmlinkage int __down_trylock(struct semaphore * sem); asmlinkage void __up(struct semaphore * sem); extern spinlock_t semaphore_wake_lock; @@ -80,75 +52,6 @@ extern spinlock_t semaphore_wake_lock; #define sema_init(sem, val) atomic_set(&((sem)->count), (val)) /* - * These two _must_ execute atomically wrt each other. - * - * This is trivially done with load_locked/store_cond, - * but on the x86 we need an external synchronizer. - */ -static inline void wake_one_more(struct semaphore * sem) -{ - unsigned long flags; - - spin_lock_irqsave(&semaphore_wake_lock, flags); - sem->waking++; - spin_unlock_irqrestore(&semaphore_wake_lock, flags); -} - -/* - * NOTE NOTE NOTE! - * - * We read owner-count _before_ getting the semaphore. This - * is important, because the semaphore also acts as a memory - * ordering point between reading owner_depth and reading - * the owner. - * - * Why is this necessary? The "owner_depth" essentially protects - * us from using stale owner information - in the case that this - * process was the previous owner but somebody else is racing to - * aquire the semaphore, the only way we can see ourselves as an - * owner is with "owner_depth" of zero (so that we know to avoid - * the stale value). - * - * In the non-race case (where we really _are_ the owner), there - * is not going to be any question about what owner_depth is. - * - * In the race case, the race winner will not even get here, because - * it will have successfully gotten the semaphore with the locked - * decrement operation. - * - * Basically, we have two values, and we cannot guarantee that either - * is really up-to-date until we have aquired the semaphore. But we - * _can_ depend on a ordering between the two values, so we can use - * one of them to determine whether we can trust the other: - * - * Cases: - * - owner_depth == zero: ignore the semaphore owner, because it - * cannot possibly be us. Somebody else may be in the process - * of modifying it and the zero may be "stale", but it sure isn't - * going to say that "we" are the owner anyway, so who cares? - * - owner_depth is non-zero. That means that even if somebody - * else wrote the non-zero count value, the write ordering requriement - * means that they will have written themselves as the owner, so - * if we now see ourselves as an owner we can trust it to be true. - */ -static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) -{ - unsigned long flags; - unsigned long owner_depth = sem->owner_depth; - int ret = 0; - - spin_lock_irqsave(&semaphore_wake_lock, flags); - if (sem->waking > 0 || (owner_depth && semaphore_owner(sem) == tsk)) { - sem->owner = (unsigned long) tsk; - sem->owner_depth++; /* Don't use the possibly stale value */ - sem->waking--; - ret = 1; - } - spin_unlock_irqrestore(&semaphore_wake_lock, flags); - return ret; -} - -/* * This is ugly, but we want the default case to fall through. * "down_failed" is a special asm handler that calls the C * routine that actually waits. See arch/i386/lib/semaphore.S @@ -161,9 +64,7 @@ extern inline void down(struct semaphore * sem) "lock ; " #endif "decl 0(%0)\n\t" - "js 2f\n\t" - "movl %%esp,4(%0)\n" - "movl $1,8(%0)\n\t" + "js 2f\n" "1:\n" ".section .text.lock,\"ax\"\n" "2:\tpushl $1b\n\t" @@ -185,8 +86,6 @@ extern inline int down_interruptible(struct semaphore * sem) #endif "decl 0(%1)\n\t" "js 2f\n\t" - "movl %%esp,4(%1)\n\t" - "movl $1,8(%1)\n\t" "xorl %0,%0\n" "1:\n" ".section .text.lock,\"ax\"\n" @@ -199,6 +98,28 @@ extern inline int down_interruptible(struct semaphore * sem) return result; } +extern inline int down_trylock(struct semaphore * sem) +{ + int result; + + __asm__ __volatile__( + "# atomic interruptible down operation\n\t" +#ifdef __SMP__ + "lock ; " +#endif + "decl 0(%1)\n\t" + "js 2f\n\t" + "xorl %0,%0\n" + "1:\n" + ".section .text.lock,\"ax\"\n" + "2:\tpushl $1b\n\t" + "jmp __down_failed_trylock\n" + ".previous" + :"=a" (result) + :"c" (sem) + :"memory"); + return result; +} /* * Note! This is subtle. We jump to wake people up only if @@ -210,7 +131,6 @@ extern inline void up(struct semaphore * sem) { __asm__ __volatile__( "# atomic up operation\n\t" - "decl 8(%0)\n\t" #ifdef __SMP__ "lock ; " #endif diff --git a/include/asm-i386/siginfo.h b/include/asm-i386/siginfo.h index d0cae4709..7c805525c 100644 --- a/include/asm-i386/siginfo.h +++ b/include/asm-i386/siginfo.h @@ -138,7 +138,7 @@ typedef struct siginfo { */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ -#define NSIGTRAP +#define NSIGTRAP 2 /* * SIGCHLD si_codes diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index 48b119895..8417d4aba 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h @@ -462,7 +462,7 @@ __asm__ __volatile__("cld\n\t" \ #define __HAVE_ARCH_MEMSET #define memset(s, c, count) \ (__builtin_constant_p(c) ? \ - __constant_c_x_memset((s),(0x01010101UL*(unsigned char)c),(count)) : \ + __constant_c_x_memset((s),(0x01010101UL*(unsigned char)(c)),(count)) : \ __memset((s),(c),(count))) /* diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 6dd4b33f0..ebdb8b790 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -9,30 +9,24 @@ struct task_struct; /* one of the stranger aspects of C forward declarations.. */ extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); -/* - * We do most of the task switching in C, but we need - * to do the EIP/ESP switch in assembly.. - */ -#define switch_to(prev,next) do { \ - unsigned long eax, edx, ecx; \ - asm volatile("pushl %%ebx\n\t" \ - "pushl %%esi\n\t" \ +#define switch_to(prev,next,last) do { \ + asm volatile("pushl %%esi\n\t" \ "pushl %%edi\n\t" \ "pushl %%ebp\n\t" \ "movl %%esp,%0\n\t" /* save ESP */ \ - "movl %5,%%esp\n\t" /* restore ESP */ \ + "movl %3,%%esp\n\t" /* restore ESP */ \ "movl $1f,%1\n\t" /* save EIP */ \ - "pushl %6\n\t" /* restore EIP */ \ + "pushl %4\n\t" /* restore EIP */ \ "jmp __switch_to\n" \ "1:\t" \ "popl %%ebp\n\t" \ "popl %%edi\n\t" \ "popl %%esi\n\t" \ - "popl %%ebx" \ :"=m" (prev->tss.esp),"=m" (prev->tss.eip), \ - "=a" (eax), "=d" (edx), "=c" (ecx) \ + "=b" (last) \ :"m" (next->tss.esp),"m" (next->tss.eip), \ - "a" (prev), "d" (next)); \ + "a" (prev), "d" (next), \ + "b" (prev)); \ } while (0) #define _set_base(addr,base) do { unsigned long __pr; \ diff --git a/include/asm-i386/termios.h b/include/asm-i386/termios.h index 6c8600060..6d576ea00 100644 --- a/include/asm-i386/termios.h +++ b/include/asm-i386/termios.h @@ -52,6 +52,7 @@ struct termio { #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #define N_IRDA 11 /* Linux IR - http://www.cs.uit.no/~dagb/irda/irda.html */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ #ifdef __KERNEL__ diff --git a/include/asm-i386/timex.h b/include/asm-i386/timex.h index bca879f73..f6cf7303d 100644 --- a/include/asm-i386/timex.h +++ b/include/asm-i386/timex.h @@ -7,6 +7,7 @@ #define _ASMi386_TIMEX_H #include <linux/config.h> +#include <asm/msr.h> #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ @@ -39,7 +40,7 @@ static inline cycles_t get_cycles (void) #else unsigned long eax, edx; - __asm__("rdtsc":"=a" (eax), "=d" (edx)); + rdtsc(eax,edx); return eax; #endif } diff --git a/include/asm-m68k/atari_SCCserial.h b/include/asm-m68k/atari_SCCserial.h index 481bd0e11..9c373bad8 100644 --- a/include/asm-m68k/atari_SCCserial.h +++ b/include/asm-m68k/atari_SCCserial.h @@ -28,6 +28,8 @@ #define SCC_BAUD_BASE_NONE 0 /* for not connected or unused * clock sources */ +#define SCC_BAUD_BASE_M147_PCLK 312500 /* 5 MHz */ +#define SCC_BAUD_BASE_M147 312500 /* 5 MHz */ #define SCC_BAUD_BASE_MVME_PCLK 781250 /* 12.5 MHz */ #define SCC_BAUD_BASE_MVME 625000 /* 10.000 MHz */ #define SCC_BAUD_BASE_BVME_PCLK 781250 /* 12.5 MHz */ /* XXX ??? */ diff --git a/include/asm-m68k/bootinfo.h b/include/asm-m68k/bootinfo.h index 74930a381..871d051fe 100644 --- a/include/asm-m68k/bootinfo.h +++ b/include/asm-m68k/bootinfo.h @@ -219,9 +219,10 @@ struct bootversion { #define AMIGA_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) #define ATARI_BOOTI_VERSION MK_BI_VERSION( 2, 1 ) #define MAC_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) +#define MVME147_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) #define MVME16x_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) #define BVME6000_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) - +#define Q40_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) #ifdef BOOTINFO_COMPAT_1_0 diff --git a/include/asm-m68k/cache.h b/include/asm-m68k/cache.h index 1be543522..b3a873938 100644 --- a/include/asm-m68k/cache.h +++ b/include/asm-m68k/cache.h @@ -9,4 +9,6 @@ #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) +#define SMP_CACHE_BYTES L1_CACHE_BYTES + #endif diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h new file mode 100644 index 000000000..f6976b43c --- /dev/null +++ b/include/asm-m68k/dvma.h @@ -0,0 +1,165 @@ +/* $Id: dvma.h,v 1.4 1999/03/27 20:23:41 tsbogend Exp $ + * include/asm-m68k/dma.h + * + * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu) + * + * Hacked to fit Sun3x needs by Thomas Bogendoerfer + */ + +#ifndef __M68K_DVMA_H +#define __M68K_DVMA_H + +/* Structure to describe the current status of DMA registers on the Sparc */ +struct sparc_dma_registers { + __volatile__ unsigned long cond_reg; /* DMA condition register */ + __volatile__ unsigned long st_addr; /* Start address of this transfer */ + __volatile__ unsigned long cnt; /* How many bytes to transfer */ + __volatile__ unsigned long dma_test; /* DMA test register */ +}; + +/* DVMA chip revisions */ +enum dvma_rev { + dvmarev0, + dvmaesc1, + dvmarev1, + dvmarev2, + dvmarev3, + dvmarevplus, + dvmahme +}; + +#define DMA_HASCOUNT(rev) ((rev)==dvmaesc1) + +/* Linux DMA information structure, filled during probe. */ +struct Linux_SBus_DMA { + struct Linux_SBus_DMA *next; + struct linux_sbus_device *SBus_dev; + struct sparc_dma_registers *regs; + + /* Status, misc info */ + int node; /* Prom node for this DMA device */ + int running; /* Are we doing DMA now? */ + int allocated; /* Are we "owned" by anyone yet? */ + + /* Transfer information. */ + unsigned long addr; /* Start address of current transfer */ + int nbytes; /* Size of current transfer */ + int realbytes; /* For splitting up large transfers, etc. */ + + /* DMA revision */ + enum dvma_rev revision; +}; + +extern struct Linux_SBus_DMA *dma_chain; + +/* Broken hardware... */ +#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1) +#define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1) + +/* Fields in the cond_reg register */ +/* First, the version identification bits */ +#define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */ +#define DMA_VERS0 0x00000000 /* Sunray DMA version */ +#define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */ +#define DMA_VERS1 0x80000000 /* DMA rev 1 */ +#define DMA_VERS2 0xa0000000 /* DMA rev 2 */ +#define DMA_VERHME 0xb0000000 /* DMA hme gate array */ +#define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */ + +#define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */ +#define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */ +#define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */ +#define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */ +#define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */ +#define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */ +#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */ +#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */ +#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */ +#define DMA_ST_WRITE 0x00000100 /* write from device to memory */ +#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */ +#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */ +#define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */ +#define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */ +#define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */ +#define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */ +#define DMA_TERM_CNTR 0x00004000 /* Terminal counter */ +#define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */ +#define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */ +#define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */ +#define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */ +#define DMA_E_BURST8 0x00040000 /* ENET: SBUS r/w burst size */ +#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */ +#define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */ +#define DMA_BRST32 0x00040000 /* SCSI: 32byte bursts */ +#define DMA_BRST16 0x00000000 /* SCSI: 16byte bursts */ +#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */ +#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */ +#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */ +#define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */ +#define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */ +#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */ +#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */ +#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */ +#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */ +#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */ +#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */ + +/* Values describing the burst-size property from the PROM */ +#define DMA_BURST1 0x01 +#define DMA_BURST2 0x02 +#define DMA_BURST4 0x04 +#define DMA_BURST8 0x08 +#define DMA_BURST16 0x10 +#define DMA_BURST32 0x20 +#define DMA_BURST64 0x40 +#define DMA_BURSTBITS 0x7f + +/* Determine highest possible final transfer address given a base */ +#define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL)) + +/* Yes, I hack a lot of elisp in my spare time... */ +#define DMA_ERROR_P(regs) ((((regs)->cond_reg) & DMA_HNDL_ERROR)) +#define DMA_IRQ_P(regs) ((((regs)->cond_reg) & (DMA_HNDL_INTR | DMA_HNDL_ERROR))) +#define DMA_WRITE_P(regs) ((((regs)->cond_reg) & DMA_ST_WRITE)) +#define DMA_OFF(regs) ((((regs)->cond_reg) &= (~DMA_ENABLE))) +#define DMA_INTSOFF(regs) ((((regs)->cond_reg) &= (~DMA_INT_ENAB))) +#define DMA_INTSON(regs) ((((regs)->cond_reg) |= (DMA_INT_ENAB))) +#define DMA_PUNTFIFO(regs) ((((regs)->cond_reg) |= DMA_FIFO_INV)) +#define DMA_SETSTART(regs, addr) ((((regs)->st_addr) = (char *) addr)) +#define DMA_BEGINDMA_W(regs) \ + ((((regs)->cond_reg |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB)))) +#define DMA_BEGINDMA_R(regs) \ + ((((regs)->cond_reg |= ((DMA_ENABLE|DMA_INT_ENAB)&(~DMA_ST_WRITE))))) + +/* For certain DMA chips, we need to disable ints upon irq entry + * and turn them back on when we are done. So in any ESP interrupt + * handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT + * when leaving the handler. You have been warned... + */ +#define DMA_IRQ_ENTRY(dma, dregs) do { \ + if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \ + } while (0) + +#define DMA_IRQ_EXIT(dma, dregs) do { \ + if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \ + } while(0) + +/* Reset the friggin' thing... */ +#define DMA_RESET(dma) do { \ + struct sparc_dma_registers *regs = dma->regs; \ + /* Let the current FIFO drain itself */ \ + sparc_dma_pause(regs, (DMA_FIFO_ISDRAIN)); \ + /* Reset the logic */ \ + regs->cond_reg |= (DMA_RST_SCSI); /* assert */ \ + __delay(400); /* let the bits set ;) */ \ + regs->cond_reg &= ~(DMA_RST_SCSI); /* de-assert */ \ + sparc_dma_enable_interrupts(regs); /* Re-enable interrupts */ \ + /* Enable FAST transfers if available */ \ + if(dma->revision>dvmarev1) regs->cond_reg |= DMA_3CLKS; \ + dma->running = 0; \ +} while(0) + +extern unsigned long dvma_alloc (unsigned long, unsigned long); +extern void dvma_free (unsigned long, unsigned long); + +#endif /* !(__M68K_DVMA_H) */ diff --git a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h new file mode 100644 index 000000000..eace8b552 --- /dev/null +++ b/include/asm-m68k/floppy.h @@ -0,0 +1,239 @@ +/* + * Q40 Architecture specific parts of the Floppy driver + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1999 + */ + +#include <asm/io.h> + +#include <linux/vmalloc.h> + + +asmlinkage void floppy_hardint(int irq, void *dev_id, struct pt_regs * regs); + +#define MAX_DMA_ADDRESS 0x00 /* nothing like that */ + +extern spinlock_t dma_spin_lock; + +static __inline__ unsigned long claim_dma_lock(void) +{ + unsigned long flags; + spin_lock_irqsave(&dma_spin_lock, flags); + return flags; +} + +static __inline__ void release_dma_lock(unsigned long flags) +{ + spin_unlock_irqrestore(&dma_spin_lock, flags); +} + + + +#define fd_inb(port) inb_p(port) +#define fd_outb(port,value) outb_p(port,value) + + +#define fd_request_dma() vdma_request_dma(FLOPPY_DMA,"floppy") +/*#define fd_free_dma() */ + + +#define fd_get_dma_residue() vdma_get_dma_residue(FLOPPY_DMA) +#define fd_dma_mem_alloc(size) vdma_mem_alloc(size) +#define fd_dma_setup(addr, size, mode, io) vdma_dma_setup(addr, size, mode, io) + + +#define fd_enable_irq() /* nothing... */ +#define fd_disable_irq() /* nothing... */ +#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) + +#define fd_free_dma() /* nothing */ + +/* No 64k boundary crossing problems on Q40 - no DMA at all */ +#define CROSS_64KB(a,s) (0) + +#define DMA_MODE_READ 0x44 /* i386 look-alike */ +#define DMA_MODE_WRITE 0x48 + + +static int q40_floppy_init(void) +{ + use_virtual_dma =1; + /* FLOPPY_IRQ=6; */ + + if (MACH_IS_Q40) + return 0x3f0; + else + return -1; +} + + + + +/* + * Again, the CMOS information doesn't work on the Q40.. + */ +#define FLOPPY0_TYPE 6 +#define FLOPPY1_TYPE 0 + + + + +#define FLOPPY_MOTOR_MASK 0xf0 + + + + +/* basically PC init + set use_virtual_dma */ +#define FDC1 q40_floppy_init() +static int FDC2 = -1; + + +#define N_FDC 1 +#define N_DRIVE 8 + + + +/* vdma stuff adapted from asm-i386/floppy.h */ + +static int virtual_dma_count=0; +static int virtual_dma_residue=0; +static char *virtual_dma_addr=0; +static int virtual_dma_mode=0; +static int doing_pdma=0; + + + +static int fd_request_irq(void) +{ + return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, + "floppy", NULL); +} + +/*#define SLOW_DOWN do{outb(0,0x80);}while(0)*/ +#define SLOW_DOWN do{int count=1;do{if(!jiffies)break;}while(count-->0);}while(0) + +asmlinkage void floppy_hardint(int irq, void *dev_id, struct pt_regs * regs) +{ + register unsigned char st; + +#undef TRACE_FLPY_INT +#define NO_FLOPPY_ASSEMBLER + +#ifdef TRACE_FLPY_INT + static int calls=0; + static int bytes=0; + static int dma_wait=0; +#endif + if(!doing_pdma) { + floppy_interrupt(irq, dev_id, regs); + return; + } + +#ifdef TRACE_FLPY_INT + if(!calls) + bytes = virtual_dma_count; +#endif + + { + register int lcount; + register char *lptr; + + /* serve 1st byte fast: */ + + st=1; + for(lcount=virtual_dma_count, lptr=virtual_dma_addr; + lcount; lcount--, lptr++) { + st=inb(virtual_dma_port+4) & 0xa0 ; + if(st != 0xa0) + break; + if(virtual_dma_mode) + outb_p(*lptr, virtual_dma_port+5); + else + *lptr = inb_p(virtual_dma_port+5); + } + + virtual_dma_count = lcount; + virtual_dma_addr = lptr; + st = inb(virtual_dma_port+4); + } + +#ifdef TRACE_FLPY_INT + calls++; +#endif + if(st == 0x20) + return; + if(!(st & 0x20)) { + virtual_dma_residue += virtual_dma_count; + virtual_dma_count=0; +#ifdef TRACE_FLPY_INT + printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", + virtual_dma_count, virtual_dma_residue, calls, bytes, + dma_wait); + calls = 0; + dma_wait=0; +#endif + doing_pdma = 0; + floppy_interrupt(irq, dev_id, regs); + return; + } +#ifdef TRACE_FLPY_INT + if(!virtual_dma_count) + dma_wait++; +#endif +} + + + +static int vdma_request_dma(unsigned int dmanr, const char * device_id) +{ + return 0; +} + + +static int vdma_get_dma_residue(unsigned int dummy) +{ + return virtual_dma_count + virtual_dma_residue; +} + + +static unsigned long vdma_mem_alloc(unsigned long size) +{ + return (unsigned long) vmalloc(size); + +} + +static void _fd_dma_mem_free(unsigned long addr, unsigned long size) +{ + vfree((void *)addr); +} +#define fd_dma_mem_free(addr,size) _fd_dma_mem_free(addr, size) + + +/* choose_dma_mode ???*/ + +static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io) +{ + doing_pdma = 1; + virtual_dma_port = io; + virtual_dma_mode = (mode == DMA_MODE_WRITE); + virtual_dma_addr = addr; + virtual_dma_count = size; + virtual_dma_residue = 0; + return 0; +} + + + +static void fd_disable_dma(void) +{ + doing_pdma = 0; + virtual_dma_residue += virtual_dma_count; + virtual_dma_count=0; +} + + + diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h index a590528a7..da5753ee7 100644 --- a/include/asm-m68k/ide.h +++ b/include/asm-m68k/ide.h @@ -45,22 +45,38 @@ #include <asm/macints.h> #endif + +typedef unsigned int q40ide_ioreg_t; + + typedef unsigned char * ide_ioreg_t; + #ifndef MAX_HWIFS #define MAX_HWIFS 4 /* same as the other archs */ #endif -static __inline int ide_default_irq (ide_ioreg_t base) +int q40ide_default_irq(q40ide_ioreg_t); + +static __inline__ int ide_default_irq(ide_ioreg_t base) { - return 0; + if (MACH_IS_Q40) + return q40ide_default_irq((q40ide_ioreg_t) base); + else return 0; } + /* * Can we do this in a generic manner?? */ +void q40_ide_init_hwif_ports (q40ide_ioreg_t *p, q40ide_ioreg_t base, int *irq); + static __inline__ void ide_init_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int *irq) { +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + return q40_ide_init_hwif_ports((q40ide_ioreg_t *)p,(q40ide_ioreg_t)base,irq); +#endif printk("ide_init_hwif_ports: must not be called\n"); } @@ -86,6 +102,10 @@ static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, voi if (MACH_IS_AMIGA) return request_irq(irq, handler, 0, device, dev_id); #endif /* CONFIG_AMIGA */ +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + return request_irq(irq, handler, 0, device, dev_id); +#endif /* CONFIG_Q40*/ #ifdef CONFIG_MAC if (MACH_IS_MAC) #if 0 /* MSch Hack: maybe later we'll call ide_intr without a wrapper */ @@ -103,6 +123,10 @@ static __inline__ void ide_free_irq(unsigned int irq, void *dev_id) if (MACH_IS_AMIGA) free_irq(irq, dev_id); #endif /* CONFIG_AMIGA */ +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + free_irq(irq, dev_id); +#endif /* CONFIG_Q40*/ #ifdef CONFIG_MAC if (MACH_IS_MAC) nubus_free_irq(12); @@ -119,10 +143,18 @@ static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent) static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name) { +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + request_region((q40ide_ioreg_t)from,extent,name); +#endif } static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent) { +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + release_region((q40ide_ioreg_t)from,extent); +#endif } #undef SUPPORT_SLOW_DATA_PORTS @@ -131,14 +163,36 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent #undef SUPPORT_VLB_SYNC #define SUPPORT_VLB_SYNC 0 +/* this definition is used only on startup .. */ +#ifndef CONFIG_Q40 #undef HD_DATA #define HD_DATA NULL +#else +#ifdef MACH_Q40_ONLY +#undef HD_DATA +#define HD_DATA ((ide_ioreg_t)0x1f0) +#else +#undef HD_DATA +#define HD_DATA (MACH_IS_Q40 ? (ide_ioreg_t)0x1f0 : 0) +#endif +#endif + #define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1) #define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1) +#ifdef CONFIG_Q40 +#ifdef MACH_Q40_ONLY +#define ADDR_TRANS(_addr_) (Q40_ISA_IO_W(_addr_)) +#else +#define ADDR_TRANS(_addr_) (MACH_IS_Q40 ? ((unsigned char *)Q40_ISA_IO_W(_addr_)) : (_addr_)) +#endif +#else +#define ADDR_TRANS(_addr_) (_addr_) +#endif + #define insw(port, buf, nr) ({ \ - unsigned char *_port = (unsigned char *)(port); \ + unsigned char *_port = (unsigned char *) ADDR_TRANS(port); \ unsigned char *_buf = (buf); \ int _nr = (nr); \ unsigned long _tmp; \ @@ -179,7 +233,7 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent }) #define outsw(port, buf, nr) ({ \ - unsigned char *_port = (unsigned char *)(port); \ + unsigned char *_port = (unsigned char *) ADDR_TRANS(port); \ unsigned char *_buf = (buf); \ int _nr = (nr); \ unsigned long _tmp; \ @@ -219,7 +273,7 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent } \ }) -#ifdef CONFIG_ATARI +#if defined(CONFIG_ATARI) || defined(CONFIG_Q40) #define insl_swapw(data_reg, buffer, wcount) \ insw_swapw(data_reg, buffer, (wcount)<<1) #define outsl_swapw(data_reg, buffer, wcount) \ @@ -236,7 +290,7 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent rolw #8,%/d0; \ movew %/d0,%/a1@+; \ dbra %/d6,1b" : \ - : "g" (port), "g" (buf), "g" (nr) \ + : "g" (ADDR_TRANS(port)), "g" (buf), "g" (nr) \ : "d0", "a0", "a1", "d6"); \ else \ __asm__ __volatile__ \ @@ -270,8 +324,9 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent rolw #8,%/d0; \ movew %/d0,%/a1@+; \ dbra %/d6,1b" : \ - : "g" (port), "g" (buf), "g" (nr) \ - : "d0", "a0", "a1", "d6") + : "g" (ADDR_TRANS(port)), "g" (buf), "g" (nr) \ + : "d0", "a0", "a1", "d6") + #define outsw_swapw(port, buf, nr) \ if ((nr) % 8) \ @@ -284,7 +339,7 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent rolw #8,%/d0; \ movew %/d0,%/a0@; \ dbra %/d6,1b" : \ - : "g" (port), "g" (buf), "g" (nr) \ + : "g" (ADDR_TRANS(port)), "g" (buf), "g" (nr) \ : "d0", "a0", "a1", "d6"); \ else \ __asm__ __volatile__ \ @@ -318,7 +373,7 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent rolw #8,%/d0; \ movew %/d0,%/a0@; \ dbra %/d6,1b" : \ - : "g" (port), "g" (buf), "g" (nr) \ + : "g" (ADDR_TRANS(port)), "g" (buf), "g" (nr) \ : "d0", "a0", "a1", "d6") #endif /* CONFIG_ATARI */ diff --git a/include/asm-m68k/keyboard.h b/include/asm-m68k/keyboard.h index eccadf2e3..555ef68ec 100644 --- a/include/asm-m68k/keyboard.h +++ b/include/asm-m68k/keyboard.h @@ -16,31 +16,46 @@ #include <asm/machdep.h> +#ifdef CONFIG_Q40 +#include <asm/q40_keyboard.h> +#endif + static __inline__ int kbd_setkeycode(unsigned int scancode, unsigned int keycode) { +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + return q40kbd_setkeycode(scancode,keycode); +#endif return -EOPNOTSUPP; } static __inline__ int kbd_getkeycode(unsigned int scancode) { +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + return q40kbd_getkeycode(scancode); +#endif return scancode > 127 ? -EINVAL : scancode; } -static __inline__ int kbd_pretranslate(unsigned char scancode, char raw_mode) -{ - return 1; -} - static __inline__ int kbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode) { +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + return q40kbd_translate(scancode,keycode,raw_mode); +#endif *keycode = scancode; return 1; } static __inline__ char kbd_unexpected_up(unsigned char keycode) { +#ifdef CONFIG_Q40 + if (MACH_IS_Q40) + return q40kbd_unexpected_up(keycode); +#endif return 0200; } diff --git a/include/asm-m68k/mvme147hw.h b/include/asm-m68k/mvme147hw.h new file mode 100644 index 000000000..f57216b9e --- /dev/null +++ b/include/asm-m68k/mvme147hw.h @@ -0,0 +1,110 @@ +#ifndef _MVME147HW_H_ +#define _MVME147HW_H_ + +typedef struct { + unsigned char + ctrl, + bcd_sec, + bcd_min, + bcd_hr, + bcd_dow, + bcd_dom, + bcd_mth, + bcd_year; +} MK48T02; + +#define RTC_WRITE 0x80 +#define RTC_READ 0x40 +#define RTC_STOP 0x20 + +#define m147_rtc ((MK48T02 * volatile)0xfffe07f8) + + +struct pcc_regs { + volatile u_long dma_tadr; + volatile u_long dma_dadr; + volatile u_long dma_bcr; + volatile u_long dma_hr; + volatile u_short t1_preload; + volatile u_short t1_count; + volatile u_short t2_preload; + volatile u_short t2_count; + volatile u_char t1_int_cntrl; + volatile u_char t1_cntrl; + volatile u_char t2_int_cntrl; + volatile u_char t2_cntrl; + volatile u_char ac_fail; + volatile u_char watchdog; + volatile u_char lpt_intr; + volatile u_char lpt_cntrl; + volatile u_char dma_intr; + volatile u_char dma_cntrl; + volatile u_char bus_error; + volatile u_char dma_status; + volatile u_char abort; + volatile u_char ta_fnctl; + volatile u_char serial_cntrl; + volatile u_char general_cntrl; + volatile u_char lan_cntrl; + volatile u_char general_status; + volatile u_char scsi_interrupt; + volatile u_char slave; + volatile u_char soft1_cntrl; + volatile u_char int_base; + volatile u_char soft2_cntrl; + volatile u_char revision_level; + volatile u_char lpt_data; + volatile u_char lpt_status; + }; + +#define m147_pcc ((struct pcc_regs * volatile)0xfffe1000) + + +#define PCC_INT_ENAB 0x08 + +#define PCC_TIMER_INT_CLR 0x80 +#define PCC_TIMER_PRELOAD 63936l + +#define PCC_LEVEL_ABORT 0x07 +#define PCC_LEVEL_SERIAL 0x04 +#define PCC_LEVEL_ETH 0x04 +#define PCC_LEVEL_TIMER1 0x04 +#define PCC_LEVEL_SCSI_PORT 0x04 +#define PCC_LEVEL_SCSI_DMA 0x04 + +#define PCC_IRQ_AC_FAIL 0x40 +#define PCC_IRQ_BERR 0x41 +#define PCC_IRQ_ABORT 0x42 +/* #define PCC_IRQ_SERIAL 0x43 */ +#define PCC_IRQ_PRINTER 0x47 +#define PCC_IRQ_TIMER1 0x48 +#define PCC_IRQ_TIMER2 0x49 +#define PCC_IRQ_SOFTWARE1 0x4a +#define PCC_IRQ_SOFTWARE2 0x4b + + +#define M147_SCC_A_ADDR 0xfffe3002 +#define M147_SCC_B_ADDR 0xfffe3000 + +#define MVME147_IRQ_SCSI_PORT 0x45 +#define MVME147_IRQ_SCSI_DMA 0x46 + +/* SCC interrupts, for MVME162 */ + +#define MVME147_IRQ_TYPE_PRIO 0 +#define MVME147_IRQ_SCC_BASE 0x60 +#define MVME147_IRQ_SCCB_TX 0x60 +#define MVME147_IRQ_SCCB_STAT 0x62 +#define MVME147_IRQ_SCCB_RX 0x64 +#define MVME147_IRQ_SCCB_SPCOND 0x66 +#define MVME147_IRQ_SCCA_TX 0x68 +#define MVME147_IRQ_SCCA_STAT 0x6a +#define MVME147_IRQ_SCCA_RX 0x6c +#define MVME147_IRQ_SCCA_SPCOND 0x6e + +#define MVME147_LANCE_BASE 0xfffe1800 +#define MVME147_LANCE_IRQ 0x44 + +#define ETHERNET_ADDRESS 0xfffe0778 + +#endif diff --git a/include/asm-m68k/oplib.h b/include/asm-m68k/oplib.h new file mode 100644 index 000000000..4ef5f0317 --- /dev/null +++ b/include/asm-m68k/oplib.h @@ -0,0 +1,8 @@ +/* + * prototypes for dummy prom_* routines + */ + +extern int prom_getintdefault(int node, char *property, int defval); +extern int prom_getbool(int node, char *prop); +extern void prom_printf(char *fmt, ...); +extern void prom_halt(void) __attribute__ ((noreturn)); diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index a3fe87e71..87384b8ae 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -110,7 +110,22 @@ typedef unsigned long pgprot_t; /* This handles the memory map.. */ #define PAGE_OFFSET 0 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) -#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) +/* + * A hacky workaround for the problems with mmap() of frame buffer + * memory in the lower 16MB physical memoryspace. + * + * This is a short term solution, we will have to deal properly + * with this in 2.3.x. + */ +extern inline void *__va(unsigned long physaddr) +{ +#ifdef CONFIG_AMIGA + if (MACH_IS_AMIGA && (physaddr < 16*1024*1024)) + return (void *)0xffffffff; + else +#endif + return (void *)(physaddr+PAGE_OFFSET); +} #define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) #endif /* __KERNEL__ */ diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index a3487fb9d..1e6f317ee 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h @@ -507,6 +507,7 @@ extern inline void SET_PAGE_DIR(struct task_struct * tsk, pgd_t * pgdir) if (tsk == current) { if (CPU_IS_040_OR_060) __asm__ __volatile__ (".chip 68040\n\t" + "pflushan\n\t" "movec %0,%%urp\n\t" ".chip 68k" : : "r" (tsk->tss.crp[1])); @@ -514,10 +515,22 @@ extern inline void SET_PAGE_DIR(struct task_struct * tsk, pgd_t * pgdir) unsigned long tmp; __asm__ __volatile__ ("movec %%cacr,%0\n\t" "orw #0x0808,%0\n\t" - "movec %0,%%cacr\n\t" - "pmove %1,%%crp\n\t" - : "=d" (tmp) - : "m" (tsk->tss.crp[0])); + "movec %0,%%cacr" + : "=d" (tmp)); + /* For a 030-only kernel, avoid flushing the whole + ATC, we only need to flush the user entries. + The 68851 does this by itself. Avoid a runtime + check here. */ + __asm__ __volatile__ ( +#ifdef CPU_M68030_ONLY + ".chip 68030\n\t" + "pmovefd %0,%%crp\n\t" + ".chip 68k\n\t" + "pflush #0,#4" +#else + "pmove %0,%%crp" +#endif + : : "m" (tsk->tss.crp[0])); } } } @@ -813,5 +826,6 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (0) +#define kern_addr_valid(addr) (1) #endif /* _M68K_PGTABLE_H */ diff --git a/include/asm-m68k/q40_keyboard.h b/include/asm-m68k/q40_keyboard.h new file mode 100644 index 000000000..e3712d2e1 --- /dev/null +++ b/include/asm-m68k/q40_keyboard.h @@ -0,0 +1,54 @@ +/* + * linux/include/asm-m68k/q40_keyboard.h + * + * Created + */ + +/* + * This file contains the Q40 specific keyboard definitions + */ + + +#include <linux/config.h> /* CONFIG_MAGIC_SYSRQ */ + + + +#ifdef __KERNEL__ + + +#include <asm/machdep.h> + + + +extern int q40kbd_setkeycode(unsigned int scancode, unsigned int keycode); +extern int q40kbd_getkeycode(unsigned int scancode); +extern int q40kbd_pretranslate(unsigned char scancode, char raw_mode); +extern int q40kbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode); +extern char q40kbd_unexpected_up(unsigned char keycode); +extern void q40kbd_leds(unsigned char leds); +extern int q40kbd_is_sysrq(unsigned char keycode); +extern void q40kbd_init_hw(void); +extern unsigned char q40kbd_sysrq_xlate[128]; + + +#if 0 +#define kbd_setkeycode q40kbd_setkeycode +#define kbd_getkeycode q40kbd_getkeycode +#define kbd_pretranslate q40kbd_pretranslate +#define kbd_translate q40kbd_translate +#define kbd_unexpected_up q40kbd_unexpected_up +#define kbd_leds q40kbd_leds +#define kbd_init_hw q40kbd_init_hw +#define kbd_is_sysrq q40kbd_is_sysrq +#define kbd_sysrq_xlate q40kbd_sysrq_xlate + + +#define SYSRQ_KEY 0x54 +#endif +#endif /* __KERNEL__ */ + + + + + diff --git a/include/asm-m68k/q40_master.h b/include/asm-m68k/q40_master.h new file mode 100644 index 000000000..b7e365b0f --- /dev/null +++ b/include/asm-m68k/q40_master.h @@ -0,0 +1,75 @@ +/* + * Q40 master Chip Control + * RTC stuff merged for compactnes.. +*/ + +#if 1 +#define q40_master_addr 0xff000000 +#define q40_rtc_addr 0xff021ffc +#else +extern unsigned long q40_master_addr; /* wherever it is mapped ... */ +extern unsigned long q40_rtc_addr; +#endif + +#define IIRQ_REG 0x0 /* internal IRQ reg */ +#define EIRQ_REG 0x4 /* external ... */ +#define KEYCODE_REG 0x1c /* value of received scancode */ +#define DISPLAY_CONTROL_REG 0x18 +#define FRAME_CLEAR_REG 0x24 + +#define INTERRUPT_REG IIRQ_REG /* "native" ints */ +#define KEY_IRQ_ENABLE_REG 0x08 /**/ +#define KEYBOARD_UNLOCK_REG 0x20 /* clear kb int */ + +#define SAMPLE_ENABLE_REG 0x14 /* generate SAMPLE ints */ +#define SAMPLE_RATE_REG 0x28 +#define SAMPLE_CLEAR_REG 0x28 +#define SAMPLE_LOW 0x00 +#define SAMPLE_HIGH 0x01 + +#define FRAME_RATE_REG 0x38 /* generate FRAME ints at 200 HZ rate */ + +#if 0 +#define SER_ENABLE_REG 0x0c /* allow serial ints to be generated */ +#endif +#define EXT_ENABLE_REG 0x10 /* ... rest of the ISA ints ... */ + +#define master_inb(_reg_) (*(((unsigned char *)q40_master_addr)+_reg_)) +#define master_outb(_b_,_reg_) (*(((unsigned char *)q40_master_addr)+_reg_)=(_b_)) + + +/* define some Q40 specific ints */ +#include "q40ints.h" + +/* RTC defines */ + +#define Q40_RTC_BASE (q40_rtc_addr) + +#define RTC_YEAR (*(unsigned char *)(Q40_RTC_BASE+0)) +#define RTC_MNTH (*(unsigned char *)(Q40_RTC_BASE-4)) +#define RTC_DATE (*(unsigned char *)(Q40_RTC_BASE-8)) +#define RTC_DOW (*(unsigned char *)(Q40_RTC_BASE-12)) +#define RTC_HOUR (*(unsigned char *)(Q40_RTC_BASE-16)) +#define RTC_MINS (*(unsigned char *)(Q40_RTC_BASE-20)) +#define RTC_SECS (*(unsigned char *)(Q40_RTC_BASE-24)) +#define RTC_CTRL (*(unsigned char *)(Q40_RTC_BASE-28)) + + +#if 0 +struct RTC_STRUCT{ + unsigned char bcd_year; + unsigned char bcd_mth; + unsigned char bcd_dom; + unsigned char bcd_dayofweek; + unsigned char bcd_hr; + unsigned char bcd_min; + unsigned char bcd_sec; + unsigned char ctrl; +}; +typedef struct RTC_STRUCT *RtcPtr_t; +#endif + + +/* some control bits */ +#define RTC_READ 64 /* prepare for reading */ +#define RTC_WRITE 128 diff --git a/include/asm-m68k/q40ints.h b/include/asm-m68k/q40ints.h new file mode 100644 index 000000000..f5e29c982 --- /dev/null +++ b/include/asm-m68k/q40ints.h @@ -0,0 +1,29 @@ +/* + * contains some Q40 related interrupt definitions + */ + +#define Q40_IRQ_MAX (34) + +#define Q40_IRQ_TIMER (34) +#define Q40_IRQ_KEYBOARD (32) +#define Q40_IRQ_FRAME (33) + + +/* masks for interrupt regiosters*/ +/* internal, IIRQ_REG */ +#define IRQ_KEYB_MASK (2) +#define IRQ_SER_MASK (1<<2) +#define IRQ_FRAME_MASK (1<<3) +#define IRQ_EXT_MASK (1<<4) /* is a EIRQ */ +/* eirq, EIRQ_REG */ +#define IRQ3_MASK (1) +#define IRQ4_MASK (1<<1) +#define IRQ5_MASK (1<<2) +#define IRQ6_MASK (1<<3) +#define IRQ7_MASK (1<<4) +#define IRQ10_MASK (1<<5) +#define IRQ14_MASK (1<<6) +#define IRQ15_MASK (1<<7) + +extern unsigned long q40_probe_irq_on (void); +extern int q40_probe_irq_off (unsigned long irqs); diff --git a/include/asm-m68k/scatterlist.h b/include/asm-m68k/scatterlist.h index 885ca6146..08691d653 100644 --- a/include/asm-m68k/scatterlist.h +++ b/include/asm-m68k/scatterlist.h @@ -6,6 +6,14 @@ struct scatterlist { char * alt_address; /* Location of actual if address is a * dma indirect buffer. NULL otherwise */ unsigned int length; + unsigned long dvma_address; +}; + +struct mmu_sglist { + char *addr; + char *__dont_touch; + unsigned int len; + unsigned long dvma_addr; }; /* This is bogus and should go away. */ diff --git a/include/asm-m68k/semaphore-helper.h b/include/asm-m68k/semaphore-helper.h new file mode 100644 index 000000000..5e3abe0b5 --- /dev/null +++ b/include/asm-m68k/semaphore-helper.h @@ -0,0 +1,136 @@ +#ifndef _M68K_SEMAPHORE_HELPER_H +#define _M68K_SEMAPHORE_HELPER_H + +/* + * SMP- and interrupt-safe semaphores helper functions. + * + * (C) Copyright 1996 Linus Torvalds + * + * m68k version by Andreas Schwab + */ + +/* + * These two _must_ execute atomically wrt each other. + */ +static inline void wake_one_more(struct semaphore * sem) +{ + atomic_inc(&sem->waking); +} + +static inline int waking_non_zero(struct semaphore *sem) +{ + int ret; +#ifndef CONFIG_RMW_INSNS + unsigned long flags; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + ret = 0; + if (atomic_read(&sem->waking) > 0) { + atomic_dec(&sem->waking); + ret = 1; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); +#else + int tmp1, tmp2; + + __asm__ __volatile__ + ("1: movel %1,%2\n" + " jle 2f\n" + " subql #1,%2\n" + " casl %1,%2,%3\n" + " jne 1b\n" + " moveq #1,%0\n" + "2:" + : "=d" (ret), "=d" (tmp1), "=d" (tmp2) + : "m" (sem->waking), "0" (0), "1" (sem->waking)); +#endif + + return ret; +} + +/* + * waking_non_zero_interruptible: + * 1 got the lock + * 0 go to sleep + * -EINTR interrupted + */ +static inline int waking_non_zero_interruptible(struct semaphore *sem, + struct task_struct *tsk) +{ + int ret; +#ifndef CONFIG_RMW_INSNS + unsigned long flags; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + ret = 0; + if (atomic_read(&sem->waking) > 0) { + atomic_dec(&sem->waking); + ret = 1; + } else if (signal_pending(tsk)) { + atomic_inc(&sem->count); + ret = -EINTR; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); +#else + int tmp1, tmp2; + + __asm__ __volatile__ + ("1: movel %1,%2\n" + " jle 2f\n" + " subql #1,%2\n" + " casl %1,%2,%3\n" + " jne 1b\n" + " moveq #1,%0\n" + " jra %a4\n" + "2:" + : "=d" (ret), "=d" (tmp1), "=d" (tmp2) + : "m" (sem->waking), "i" (&&next), "0" (0), "1" (sem->waking)); + if (signal_pending(tsk)) { + atomic_inc(&sem->count); + ret = -EINTR; + } +next: +#endif + + return ret; +} + +/* + * waking_non_zero_trylock: + * 1 failed to lock + * 0 got the lock + */ +static inline int waking_non_zero_trylock(struct semaphore *sem) +{ + int ret; +#ifndef CONFIG_RMW_INSNS + unsigned long flags; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + ret = 1; + if (atomic_read(&sem->waking) > 0) { + atomic_dec(&sem->waking); + ret = 0; + } else + atomic_inc(&sem->count); + spin_unlock_irqrestore(&semaphore_wake_lock, flags); +#else + int tmp1, tmp2; + + __asm__ __volatile__ + ("1: movel %1,%2\n" + " jle 2f\n" + " subql #1,%2\n" + " casl %1,%2,%3\n" + " jne 1b\n" + " moveq #0,%0\n" + "2:" + : "=d" (ret), "=d" (tmp1), "=d" (tmp2) + : "m" (sem->waking), "0" (1), "1" (sem->waking)); + if (ret) + atomic_inc(&sem->count); +#endif + return ret; +} + +#endif diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h index 9d05256df..271169bbc 100644 --- a/include/asm-m68k/semaphore.h +++ b/include/asm-m68k/semaphore.h @@ -3,9 +3,10 @@ #include <linux/config.h> #include <linux/linkage.h> -#include <asm/current.h> + #include <asm/system.h> #include <asm/atomic.h> +#include <asm/spinlock.h> /* * SMP- and interrupt-safe semaphores.. @@ -17,79 +18,25 @@ struct semaphore { atomic_t count; - unsigned long owner, owner_depth; atomic_t waking; struct wait_queue * wait; }; -/* - * Because we want the non-contention case to be - * fast, we save the stack pointer into the "owner" - * field, and to get the true task pointer we have - * to do the bit masking. That moves the masking - * operation into the slow path. - */ -#define semaphore_owner(sem) \ - ((struct task_struct *)((2*PAGE_MASK) & (sem)->owner)) - -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, 0, ATOMIC_INIT(0), NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, 1, ATOMIC_INIT(0), NULL }) +#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL }) +#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL }) asmlinkage void __down_failed(void /* special register calling convention */); asmlinkage int __down_failed_interruptible(void /* params in registers */); +asmlinkage int __down_failed_trylock(void /* params in registers */); asmlinkage void __up_wakeup(void /* special register calling convention */); -extern void __down(struct semaphore * sem); -extern int __down_interruptible(struct semaphore * sem); -extern void __up(struct semaphore * sem); +asmlinkage void __down(struct semaphore * sem); +asmlinkage int __down_interruptible(struct semaphore * sem); +asmlinkage int __down_trylock(struct semaphore * sem); +asmlinkage void __up(struct semaphore * sem); #define sema_init(sem, val) atomic_set(&((sem)->count), val) -static inline void wake_one_more(struct semaphore * sem) -{ - atomic_inc(&sem->waking); -} - -static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) -{ -#ifndef CONFIG_RMW_INSNS - unsigned long flags; - int ret = 0; - - save_flags(flags); - cli(); - if (atomic_read(&sem->waking) > 0 || (owner_depth && semaphore_owner(sem) == tsk)) { - sem->owner = (unsigned long)tsk; - sem->owner_depth++; - atomic_dec(&sem->waking); - ret = 1; - } - restore_flags(flags); -#else - int ret, tmp; - - __asm__ __volatile__ - ("1: movel %2,%0\n" - " jeq 3f\n" - "2: movel %0,%1\n" - " subql #1,%1\n" - " casl %0,%1,%2\n" - " jeq 3f\n" - " tstl %0\n" - " jne 2b\n" - "3:" - : "=d" (ret), "=d" (tmp), "=m" (sem->waking)); - - ret |= ((sem->owner_depth != 0) && (semaphore_owner(sem) == tsk)); - if (ret) { - sem->owner = (unsigned long)tsk; - sem->owner_depth++; - } - -#endif - return ret; -} - /* * This is ugly, but we want the default case to fall through. * "down_failed" is a special asm handler that calls the C @@ -102,8 +49,6 @@ extern inline void down(struct semaphore * sem) "| atomic down operation\n\t" "subql #1,%0@\n\t" "jmi 2f\n\t" - "movel %%sp,4(%0)\n" - "movel #1,8(%0)\n\t" "1:\n" ".section .text.lock,\"ax\"\n" ".even\n" @@ -124,9 +69,6 @@ extern inline int down_interruptible(struct semaphore * sem) "| atomic interruptible down operation\n\t" "subql #1,%1@\n\t" "jmi 2f\n\t" - "movel %%sp,4(%1)\n" - "moveql #1,%0\n" - "movel %0,8(%1)\n" "clrl %0\n" "1:\n" ".section .text.lock,\"ax\"\n" @@ -140,6 +82,28 @@ extern inline int down_interruptible(struct semaphore * sem) return result; } +extern inline int down_trylock(struct semaphore * sem) +{ + register struct semaphore *sem1 __asm__ ("%a1") = sem; + register int result __asm__ ("%d0"); + + __asm__ __volatile__( + "| atomic down trylock operation\n\t" + "subql #1,%1@\n\t" + "jmi 2f\n\t" + "clrl %0\n" + "1:\n" + ".section .text.lock,\"ax\"\n" + ".even\n" + "2:\tpea 1b\n\t" + "jbra __down_failed_trylock\n" + ".previous" + : "=d" (result) + : "a" (sem1) + : "%d0", "memory"); + return result; +} + /* * Note! This is subtle. We jump to wake people up only if * the semaphore was negative (== somebody was waiting on it). @@ -151,13 +115,13 @@ extern inline void up(struct semaphore * sem) register struct semaphore *sem1 __asm__ ("%a1") = sem; __asm__ __volatile__( "| atomic up operation\n\t" - "subql #1,8(%0)\n\t" "addql #1,%0@\n\t" "jle 2f\n" "1:\n" ".section .text.lock,\"ax\"\n" ".even\n" - "2:\tpea 1b\n\t" + "2:\t" + "pea 1b\n\t" "jbra __up_wakeup\n" ".previous" : /* no outputs */ diff --git a/include/asm-m68k/serial.h b/include/asm-m68k/serial.h index a5f0abeb3..15cc547a0 100644 --- a/include/asm-m68k/serial.h +++ b/include/asm-m68k/serial.h @@ -1,448 +1,84 @@ /* - * include/linux/serial.h + * include/asm-m68k/serial.h * - * Copyright (C) 1992 by Theodore Ts'o. - * - * Redistribution of this file is permitted under the terms of the GNU - * Public License (GPL) - */ - -#ifndef _M68K_SERIAL_H -#define _M68K_SERIAL_H - - -/* m68k serial port types are numbered from 100 to avoid interference - * with the PC types (1..4) - */ -#define PORT_UNKNOWN 0 -#define PORT_8250 1 -#define PORT_16450 2 -#define PORT_16550 3 -#define PORT_16550A 4 -#define PORT_CIRRUS 5 -#define PORT_16650V2 7 -#define PORT_16750 8 - -#define SER_SCC_NORM 100 /* standard SCC channel */ -#define SER_SCC_DMA 101 /* SCC channel with DMA support */ -#define SER_MFP_CTRL 102 /* standard MFP port with modem control signals */ -#define SER_MFP_BARE 103 /* MFP port without modem controls */ -#define SER_MIDI 104 /* Atari MIDI */ -#define SER_AMIGA 105 /* Amiga built-in serial port */ -#define SER_IOEXT 106 /* Amiga GVP IO-Extender (16c552) */ -#define SER_MFC_III 107 /* Amiga BSC Multiface Card III (MC68681) */ -#define SER_WHIPPET 108 /* Amiga Hisoft Whippet PCMCIA (16c550B) */ -#define SER_SCC_MVME 109 /* MVME162/MVME172 ports */ -#define SER_SCC_MAC 110 /* Macintosh SCC channel */ -#define SER_HPDCA 111 /* HP DCA serial */ -#define SER_SCC_BVME 112 /* BVME6000 ports */ - -struct serial_struct { - int type; - int line; - int port; - int irq; - int flags; - int xmit_fifo_size; - int custom_divisor; - int baud_base; - unsigned short close_delay; - char reserved_char[2]; - int hub6; - unsigned short closing_wait; /* time to wait before closing */ - unsigned short closing_wait2; /* no longer used... */ - int reserved[4]; -}; - -/* - * For the close wait times, 0 means wait forever for serial port to - * flush its output. 65535 means don't wait at all. - */ -#define ASYNC_CLOSING_WAIT_INF 0 -#define ASYNC_CLOSING_WAIT_NONE 65535 - -/* This function tables does the abstraction from the underlying - * hardware: + * currently this seems usefull only for a Q40, + * its an almost exact copy of ../asm/alpha/serial.h * - * init(): Initialize the port as necessary, set RTS and DTR and - * enable interrupts. It does not need to set the speed and other - * parameters, because change_speed() is called, too. - * deinit(): Stop and shutdown the port (e.g. disable interrupts, ...) - * enab_tx_int(): Enable or disable the Tx Buffer Empty interrupt - * independently from other interrupt sources. If the int is - * enabled, the transmitter should also be restarted, i.e. if there - * are any chars to be sent, they should be put into the Tx - * register. The real en/disabling of the interrupt may be a no-op - * if there is no way to do this or it is too complex. This Tx ints - * are just disabled to save some interrupts if the transmitter is - * stopped anyway. But the restarting must be implemented! - * check_custom_divisor(): Check the given custom divisor for legality - * and return 0 if OK, non-zero otherwise. - * change_speed(): Set port speed, character size, number of stop - * bits and parity from the termios structure. If the user wants - * to set the speed with a custom divisor, he is required to - * check the baud_base first! - * throttle(): Set or clear the RTS line according to 'status'. - * set_break(): Set or clear the 'Send a Break' flag. - * get_serial_info(): Fill in the baud_base and custom_divisor - * fields of a serial_struct. It may also modify other fields, if - * needed. - * get_modem_info(): Return the status of RTS, DTR, DCD, RI, DSR and CTS. - * set_modem_info(): Set the status of RTS and DTR according to - * 'new_dtr' and 'new_rts', resp. 0 = clear, 1 = set, -1 = don't change - * ioctl(): Process any port-specific ioctl's. This pointer may be - * NULL, if the port has no own ioctl's. - * stop_receive(): Turn off the Rx part of the port, so no more characters - * will be received. This is called before shutting the port down. - * trans_empty(): Return !=0 if there are no more characters still to be - * sent out (Tx buffer register and FIFOs empty) - * check_open(): Is called before the port is opened. The driver can check - * if that's ok and return an error code, or keep track of the opening - * even before init() is called. Use deinit() for matching closing of the - * port. - * - */ - -struct m68k_async_struct; - -typedef struct { - void (*init)( struct m68k_async_struct *info ); - void (*deinit)( struct m68k_async_struct *info, int leave_dtr ); - void (*enab_tx_int)( struct m68k_async_struct *info, int enab_flag ); - int (*check_custom_divisor)( struct m68k_async_struct *info, int baud_base, - int divisor ); - void (*change_speed)( struct m68k_async_struct *info ); - void (*throttle)( struct m68k_async_struct *info, int status ); - void (*set_break)( struct m68k_async_struct *info, int break_flag ); - void (*get_serial_info)( struct m68k_async_struct *info, - struct serial_struct *retinfo ); - unsigned int (*get_modem_info)( struct m68k_async_struct *info ); - int (*set_modem_info)( struct m68k_async_struct *info, int new_dtr, - int new_rts ); - int (*ioctl)( struct tty_struct *tty, struct file *file, - struct m68k_async_struct *info, unsigned int cmd, - unsigned long arg ); - void (*stop_receive)( struct m68k_async_struct *info ); - int (*trans_empty)( struct m68k_async_struct *info ); - int (*check_open)( struct m68k_async_struct *info, struct tty_struct *tty, - struct file *file ); -} SERIALSWITCH; - -/* - * Definitions for m68k_async_struct (and serial_struct) flags field */ -#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes - on the callout port */ -#define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ -#define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ -#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ - -#define ASYNC_SPD_MASK 0x1030 -#define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ - -#define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ -#define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ - -#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ -#define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ -#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ -#define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ -#define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ - -#define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */ - -#define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */ -#define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */ - -#define ASYNC_FLAGS 0x1FFF /* Possible legal async flags */ -#define ASYNC_USR_MASK 0x1430 /* Legal flags that non-privileged - * users can set or reset */ - -/* Internal flags used only by drivers/char/m68kserial.c */ -#define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */ -#define ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */ -#define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ -#define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ -#define ASYNC_CLOSING 0x08000000 /* Serial port is closing */ -#define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ -#define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ - -#define ASYNC_INTERNAL_FLAGS 0xFF000000 /* Internal flags */ - -/* - * Serial input interrupt line counters -- external structure - * Four lines can interrupt: CTS, DSR, RI, DCD - */ -struct serial_icounter_struct { - int cts, dsr, rng, dcd; - int rx, tx; - int frame, overrun, parity, brk; - int buf_overrun; - int reserved[9]; -}; +#include <linux/config.h> +#if 0 +#define rs_init serial_rs_init +#define register_serial serial_register_serial +#define unregister_serial serial_unregister_serial +#endif -#ifdef __KERNEL__ /* - * This is our internal structure for each serial port's state. - * - * Many fields are paralleled by the structure used by the serial_struct - * structure. + * This assumes you have a 1.8432 MHz clock for your UART. * - * For definitions of the flags field, see tty.h + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. */ - -#include <linux/termios.h> -#include <linux/tqueue.h> - -#include <linux/config.h> /* for Mac SCC extensions */ - -#ifdef CONFIG_MAC -#define NUM_ZSREGS 16 -struct mac_zschannel { - volatile unsigned char *control; - volatile unsigned char *data; -}; -struct m68k_async_private; +#define BASE_BAUD ( 1843200 / 16 ) + +/* Standard COM flags (except for COM4, because of the 8514 problem) */ +#ifdef CONFIG_SERIAL_DETECT_IRQ +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) +#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) +#else +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF #endif -struct m68k_async_struct { - int magic; - int baud_base; - int port; - int irq; - int flags; /* defined in tty.h */ - int hub6; /* HUB6 plus one */ - int type; - struct tty_struct *tty; - int read_status_mask; - int ignore_status_mask; - int timeout; - int xmit_fifo_size; - int custom_divisor; - int x_char; /* xon/xoff character */ - int close_delay; - unsigned short closing_wait; - unsigned short closing_wait2; - int IER; /* Interrupt Enable Register */ - int MCR; /* Modem control register */ - int MCR_noint; /* MCR with interrupts off */ - unsigned long event; - unsigned long last_active; - int line; - int count; /* # of fd on device */ - int blocked_open; /* # of blocked opens */ - long session; /* Session of opening process */ - long pgrp; /* pgrp of opening process */ - unsigned char *xmit_buf; - int xmit_head; - int xmit_tail; - int xmit_cnt; - struct tq_struct tqueue; - struct termios normal_termios; - struct termios callout_termios; - struct wait_queue *open_wait; - struct wait_queue *close_wait; - struct wait_queue *delta_msr_wait; - struct async_icount icount; /* kernel counters for the 4 input interrupts */ - struct m68k_async_struct *next_port; /* For the linked list */ - struct m68k_async_struct *prev_port; - void *board_base; /* board-base address for use with - boards carrying several UART's, - like some Amiga boards. */ - unsigned short nr_uarts; /* UART-counter, that indicates - how many UART's there are on - the board. If the board has a - IRQ-register, this can be used - to check if any of the uarts, - on the board has requested an - interrupt, instead of checking - IRQ-registers on all UART's */ - SERIALSWITCH *sw; /* functions to manage this port */ -#ifdef CONFIG_MAC - struct m68k_async_private *private; +#ifdef CONFIG_SERIAL_MANY_PORTS +#define FOURPORT_FLAGS ASYNC_FOURPORT +#define ACCENT_FLAGS 0 +#define BOCA_FLAGS 0 #endif -}; - -#ifdef CONFIG_MAC -struct m68k_async_private { - struct m68k_async_info *zs_next; /* For IRQ servicing chain */ - struct mac_zschannel *zs_channel; /* Channel registers */ - struct mac_zschannel *zs_chan_a; /* A side registers */ - unsigned char read_reg_zero; - - char soft_carrier; /* Use soft carrier on this */ - char break_abort; /* console, process brk/abrt */ - char kgdb_channel; /* Kgdb running on this channel */ - char is_cons; /* Is this our console. */ - unsigned char tx_active; /* character being xmitted */ - unsigned char tx_stopped; /* output is suspended */ - - /* We need to know the current clock divisor - * to read the bps rate the chip has currently - * loaded. - */ - unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */ - int zs_baud; - - /* Current write register values */ - unsigned char curregs[NUM_ZSREGS]; - - /* Values we need to set next opportunity */ - unsigned char pendregs[NUM_ZSREGS]; - - char change_needed; -}; -#endif -#define SERIAL_MAGIC 0x5301 - -/* - * The size of the serial xmit buffer is 1 page, or 4096 bytes - */ -#define SERIAL_XMIT_SIZE 4096 - -/* - * Events are used to schedule things to happen at timer-interrupt - * time, instead of at rs interrupt time. - */ -#define RS_EVENT_WRITE_WAKEUP 0 - -/* number of characters left in xmit buffer before we ask for more */ -#define WAKEUP_CHARS 256 - -/* Export to allow PCMCIA to use this - Dave Hinds */ -extern int register_serial(struct serial_struct *req); -extern void unregister_serial(int line); -extern struct m68k_async_struct rs_table[]; -extern task_queue tq_serial; - - -/* - * This routine is used by the interrupt handler to schedule - * processing in the software interrupt portion of the driver. - */ -static __inline__ void rs_sched_event(struct m68k_async_struct *info, int event) -{ - info->event |= 1 << event; - queue_task(&info->tqueue, &tq_serial); - mark_bh(SERIAL_BH); -} - -static __inline__ void rs_receive_char( struct m68k_async_struct *info, - int ch, int err ) -{ - struct tty_struct *tty = info->tty; - - if (tty->flip.count >= TTY_FLIPBUF_SIZE) - return; - tty->flip.count++; - switch(err) { - case TTY_BREAK: - info->icount.brk++; - if (info->flags & ASYNC_SAK) - do_SAK(tty); - break; - case TTY_PARITY: - info->icount.parity++; - break; - case TTY_OVERRUN: - info->icount.overrun++; - break; - case TTY_FRAME: - info->icount.frame++; - break; - } - *tty->flip.flag_buf_ptr++ = err; - *tty->flip.char_buf_ptr++ = ch; - info->icount.rx++; - tty_flip_buffer_push(tty); -} - -static __inline__ int rs_get_tx_char( struct m68k_async_struct *info ) -{ - unsigned char ch; - - if (info->x_char) { - ch = info->x_char; - info->icount.tx++; - info->x_char = 0; - return( ch ); - } - - if (info->xmit_cnt <= 0 || info->tty->stopped || info->tty->hw_stopped) - return( -1 ); - - ch = info->xmit_buf[info->xmit_tail++]; - info->xmit_tail &= SERIAL_XMIT_SIZE - 1; - info->icount.tx++; - if (--info->xmit_cnt < WAKEUP_CHARS) - rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); - return( ch ); -} - -static __inline__ int rs_no_more_tx( struct m68k_async_struct *info ) -{ - return( info->xmit_cnt <= 0 || - info->tty->stopped || - info->tty->hw_stopped ); -} - -static __inline__ void rs_dcd_changed( struct m68k_async_struct *info, int dcd ) - -{ - /* update input line counter */ - info->icount.dcd++; - wake_up_interruptible(&info->delta_msr_wait); - - if (info->flags & ASYNC_CHECK_CD) { -#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) - printk("ttyS%d CD now %s...", info->line, - dcd ? "on" : "off"); -#endif - if (dcd) { - wake_up_interruptible(&info->open_wait); - } else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) && - (info->flags & ASYNC_CALLOUT_NOHUP))) { -#ifdef SERIAL_DEBUG_OPEN - printk("scheduling hangup..."); -#endif - if (info->tty) - tty_hangup(info->tty); - } - } -} - - -void rs_stop( struct tty_struct *tty ); -void rs_start( struct tty_struct *tty ); - -static __inline__ void rs_check_cts( struct m68k_async_struct *info, int cts ) -{ - /* update input line counter */ - info->icount.cts++; - wake_up_interruptible(&info->delta_msr_wait); - if ((info->flags & ASYNC_CTS_FLOW) && info->tty) { - if (info->tty->hw_stopped) { - if (cts) { -#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) - printk("CTS tx start..."); +#define STD_SERIAL_PORT_DEFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ + + +#ifdef CONFIG_SERIAL_MANY_PORTS +#define EXTRA_SERIAL_PORT_DEFNS \ + { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ + { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ + { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ + { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ + { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ + { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ + { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ + { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ + { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ + { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ + { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ + { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ + { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ + { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ + { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ + { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ + { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ + { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ + { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ + { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ + { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ + { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ + { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ + { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ + { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ + { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ + { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ + { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ +#else +#define EXTRA_SERIAL_PORT_DEFNS #endif - info->tty->hw_stopped = 0; - rs_start( info->tty ); - rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); - return; - } - } else { - if (!cts) { - info->tty->hw_stopped = 1; - rs_stop( info->tty ); - } - } - } -} - - -#endif /* __KERNEL__ */ -#endif /* _M68K_SERIAL_H */ +#define SERIAL_PORT_DFNS \ + STD_SERIAL_PORT_DEFNS \ + EXTRA_SERIAL_PORT_DEFNS diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h index 197d96f1e..d857208fe 100644 --- a/include/asm-m68k/setup.h +++ b/include/asm-m68k/setup.h @@ -39,6 +39,8 @@ #define MACH_MVME16x 7 #define MACH_BVME6000 8 #define MACH_HP300 9 +#define MACH_Q40 10 +#define MACH_SUN3X 11 #ifdef __KERNEL__ @@ -49,7 +51,9 @@ extern unsigned long m68k_machtype; #if !defined(CONFIG_AMIGA) # define MACH_IS_AMIGA (0) #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \ - || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) + || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ + || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) # define MACH_IS_AMIGA (m68k_machtype == MACH_AMIGA) #else # define MACH_AMIGA_ONLY @@ -60,7 +64,9 @@ extern unsigned long m68k_machtype; #if !defined(CONFIG_ATARI) # define MACH_IS_ATARI (0) #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \ - || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) + || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ + || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) # define MACH_IS_ATARI (m68k_machtype == MACH_ATARI) #else # define MACH_ATARI_ONLY @@ -71,7 +77,9 @@ extern unsigned long m68k_machtype; #if !defined(CONFIG_MAC) # define MACH_IS_MAC (0) #elif defined(CONFIG_AMIGA) || defined(CONFIG_ATARI) || defined(CONFIG_APOLLO) \ - || defined(CONFIG_HP300) || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) + || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ + || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) # define MACH_IS_MAC (m68k_machtype == MACH_MAC) #else # define MACH_MAC_ONLY @@ -88,7 +96,9 @@ extern unsigned long m68k_machtype; #if !defined (CONFIG_APOLLO) # define MACH_IS_APOLLO (0) #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ - || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) + || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ + || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) # define MACH_IS_APOLLO (m68k_machtype == MACH_APOLLO) #else # define MACH_APOLLO_ONLY @@ -96,10 +106,25 @@ extern unsigned long m68k_machtype; # define MACH_TYPE (MACH_APOLLO) #endif +#if !defined (CONFIG_MVME147) +# define MACH_IS_MVME147 (0) +#elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ + || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) \ + || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME16x) +# define MACH_IS_MVME147 (m68k_machtype == MACH_MVME147) +#else +# define MACH_MVME147_ONLY +# define MACH_IS_MVME147 (1) +# define MACH_TYPE (MACH_MVME147) +#endif + #if !defined (CONFIG_MVME16x) # define MACH_IS_MVME16x (0) #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ - || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) + || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) \ + || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) # define MACH_IS_MVME16x (m68k_machtype == MACH_MVME16x) #else # define MACH_MVME16x_ONLY @@ -110,7 +135,9 @@ extern unsigned long m68k_machtype; #if !defined (CONFIG_BVME6000) # define MACH_IS_BVME6000 (0) #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ - || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) || defined(CONFIG_HP300) + || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ + || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) # define MACH_IS_BVME6000 (m68k_machtype == MACH_BVME6000) #else # define MACH_BVME6000_ONLY @@ -121,14 +148,42 @@ extern unsigned long m68k_machtype; #if !defined (CONFIG_HP300) # define MACH_IS_HP300 (0) #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ - || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) -# define MAC_IS_HP300 (m68k_machtype == MACH_HP300) + || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ + || defined(CONFIG_BVME6000) || defined(CONFIG_Q40) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) +# define MACH_IS_HP300 (m68k_machtype == MACH_HP300) #else # define MACH_HP300_ONLY # define MACH_IS_HP300 (1) # define MACH_TYPE (MACH_HP300) #endif +#if !defined (CONFIG_Q40) +# define MACH_IS_Q40 (0) +#elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ + || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ + || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) \ + || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) +# define MACH_IS_Q40 (m68k_machtype == MACH_Q40) +#else +# define MACH_Q40_ONLY +# define MACH_IS_Q40 (1) +# define MACH_TYPE (MACH_Q40) +#endif + +#if !defined (CONFIG_SUN3X) +# define MACH_IS_SUN3X (0) +#elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ + || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ + || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) \ + || defined(CONFIG_Q40) || defined(CONFIG_MVME147) +# define MACH_IS_SUN3X (m68k_machtype == MACH_SUN3X) +#else +# define CONFIG_SUN3X_ONLY +# define MACH_IS_SUN3X (1) +# define MACH_TYPE (MACH_SUN3X) +#endif + #ifndef MACH_TYPE # define MACH_TYPE (m68k_machtype) #endif diff --git a/include/asm-m68k/sun3x.h b/include/asm-m68k/sun3x.h new file mode 100644 index 000000000..da132862a --- /dev/null +++ b/include/asm-m68k/sun3x.h @@ -0,0 +1,24 @@ +#ifndef SUN3X_H +#define SUN3X_H + +/* hardware addresses */ +#define SUN3X_IOMMU 0x60000000 +#define SUN3X_ENAREG 0x61000000 +#define SUN3X_INTREG 0x61001400 +#define SUN3X_DIAGREG 0x61001800 +#define SUN3X_ZS1 0x62000000 +#define SUN3X_ZS2 0x62002000 +#define SUN3X_LANCE 0x65002000 +#define SUN3X_EEPROM 0x64000000 +#define SUN3X_IDPROM 0x640007d8 +#define SUN3X_VIDEO_BASE 0x50000000 +#define SUN3X_VIDEO_P4ID 0x50300000 +#define SUN3X_ESP_BASE 0x66000000 +#define SUN3X_ESP_DMA 0x66001000 + +/* some NVRAM addresses */ +#define SUN3X_EEPROM_CONS (SUN3X_EEPROM + 0x1f) +#define SUN3X_EEPROM_PORTA (SUN3X_EEPROM + 0x58) +#define SUN3X_EEPROM_PORTB (SUN3X_EEPROM + 0x60) + +#endif diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h index 86d3d38f1..03353e44c 100644 --- a/include/asm-m68k/system.h +++ b/include/asm-m68k/system.h @@ -43,12 +43,14 @@ extern inline void wrusp(unsigned long usp) { * the mm structures are shared in d2 (to avoid atc flushing). */ asmlinkage void resume(void); -#define switch_to(prev,next) { \ +#define switch_to(prev,next,last) { \ register void *_prev __asm__ ("a0") = (prev); \ register void *_next __asm__ ("a1") = (next); \ + register void *_last __asm__ ("d1"); \ __asm__ __volatile__("jbsr " SYMBOL_NAME_STR(resume) \ - : : "a" (_prev), "a" (_next) \ + : "=d" (_last) : "a" (_prev), "a" (_next) \ : "d0", "d1", "d2", "d3", "d4", "d5", "a0", "a1"); \ + (last) = _last; \ } #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) @@ -66,6 +68,8 @@ struct __xchg_dummy { unsigned long a[100]; }; #define __cli() __asm__ __volatile__ ("oriw #0x0700,%/sr": : : "memory") #define nop() __asm__ __volatile__ ("nop"::) #define mb() __asm__ __volatile__ ("" : : :"memory") +#define rmb() __asm__ __volatile__ ("" : : :"memory") +#define wmb() __asm__ __volatile__ ("" : : :"memory") #define __save_flags(x) \ __asm__ __volatile__("movew %/sr,%0":"=d" (x) : /* no input */ :"memory") diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h index a65484efb..fcc26bf03 100644 --- a/include/asm-m68k/termios.h +++ b/include/asm-m68k/termios.h @@ -60,6 +60,7 @@ struct termio { #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ #ifdef __KERNEL__ diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h index aa1b4494f..548ce9ede 100644 --- a/include/asm-m68k/uaccess.h +++ b/include/asm-m68k/uaccess.h @@ -759,6 +759,10 @@ __constant_copy_to_user(void *to, const void *from, unsigned long n) #define __copy_from_user(to, from, n) copy_from_user(to, from, n) #define __copy_to_user(to, from, n) copy_to_user(to, from, n) +#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) + +#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) + /* * Copy a null terminated string from userspace. */ diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h index 83211ad98..1ed0b0833 100644 --- a/include/asm-mips/cache.h +++ b/include/asm-mips/cache.h @@ -9,4 +9,6 @@ #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) +#define SMP_CACHE_BYTES L1_CACHE_BYTES + #endif /* __ASM_MIPS_CACHE_H */ diff --git a/include/asm-mips/keyboard.h b/include/asm-mips/keyboard.h index 2b1901a9e..9b30c45c2 100644 --- a/include/asm-mips/keyboard.h +++ b/include/asm-mips/keyboard.h @@ -5,7 +5,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * $Id: keyboard.h,v 1.11 1998/09/19 19:19:37 ralf Exp $ + * $Id: keyboard.h,v 1.12 1999/01/04 16:09:22 ralf Exp $ */ #ifndef __ASM_MIPS_KEYBOARD_H #define __ASM_MIPS_KEYBOARD_H @@ -21,7 +21,6 @@ extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); -extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pckbd_unexpected_up(unsigned char keycode); @@ -31,7 +30,6 @@ extern unsigned char pckbd_sysrq_xlate[128]; #define kbd_setkeycode pckbd_setkeycode #define kbd_getkeycode pckbd_getkeycode -#define kbd_pretranslate pckbd_pretranslate #define kbd_translate pckbd_translate #define kbd_unexpected_up pckbd_unexpected_up #define kbd_leds pckbd_leds diff --git a/include/asm-mips/offset.h b/include/asm-mips/offset.h index 73ec088ba..a6d698336 100644 --- a/include/asm-mips/offset.h +++ b/include/asm-mips/offset.h @@ -51,31 +51,31 @@ #define TASK_NEED_RESCHED 20 #define TASK_COUNTER 24 #define TASK_PRIORITY 28 -#define TASK_MM 928 +#define TASK_MM 920 /* MIPS specific thread_struct offsets. */ -#define THREAD_REG16 568 -#define THREAD_REG17 572 -#define THREAD_REG18 576 -#define THREAD_REG19 580 -#define THREAD_REG20 584 -#define THREAD_REG21 588 -#define THREAD_REG22 592 -#define THREAD_REG23 596 -#define THREAD_REG29 600 -#define THREAD_REG30 604 -#define THREAD_REG31 608 -#define THREAD_STATUS 612 -#define THREAD_FPU 616 -#define THREAD_BVADDR 880 -#define THREAD_BUADDR 884 -#define THREAD_ECODE 888 -#define THREAD_TRAPNO 892 -#define THREAD_PGDIR 896 -#define THREAD_MFLAGS 900 -#define THREAD_CURDS 904 -#define THREAD_TRAMP 908 -#define THREAD_OLDCTX 912 +#define THREAD_REG16 560 +#define THREAD_REG17 564 +#define THREAD_REG18 568 +#define THREAD_REG19 572 +#define THREAD_REG20 576 +#define THREAD_REG21 580 +#define THREAD_REG22 584 +#define THREAD_REG23 588 +#define THREAD_REG29 592 +#define THREAD_REG30 596 +#define THREAD_REG31 600 +#define THREAD_STATUS 604 +#define THREAD_FPU 608 +#define THREAD_BVADDR 872 +#define THREAD_BUADDR 876 +#define THREAD_ECODE 880 +#define THREAD_TRAPNO 884 +#define THREAD_PGDIR 888 +#define THREAD_MFLAGS 892 +#define THREAD_CURDS 896 +#define THREAD_TRAMP 900 +#define THREAD_OLDCTX 904 /* Linux mm_struct offsets. */ #define MM_COUNT 16 diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index e21766bb0..521778afb 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.17 1998/09/16 21:37:38 tsbogend Exp $ +/* $Id: pgtable.h,v 1.18 1999/02/15 02:22:11 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -589,6 +589,7 @@ extern void (*update_mmu_cache)(struct vm_area_struct *vma, /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (0) +#define kern_addr_valid(addr) (1) /* TLB operations. */ extern inline void tlb_probe(void) diff --git a/include/asm-mips/semaphore-helper.h b/include/asm-mips/semaphore-helper.h new file mode 100644 index 000000000..63103c514 --- /dev/null +++ b/include/asm-mips/semaphore-helper.h @@ -0,0 +1,125 @@ +/* $Id: semaphore-helper.h,v 1.2 1999/06/10 08:02:41 ralf Exp $ + * + * SMP- and interrupt-safe semaphores helper functions. + * + * (C) Copyright 1996 Linus Torvalds + * (C) Copyright 1999 Andrea Arcangeli + * (C) Copyright 1999 Ralf Baechle + */ +#ifndef __ASM_MIPS_SEMAPHORE_HELPER_H +#define __ASM_MIPS_SEMAPHORE_HELPER_H + +/* + * These two _must_ execute atomically wrt each other. + */ +static inline void wake_one_more(struct semaphore * sem) +{ + atomic_inc(&sem->waking); +} + +static inline int +waking_non_zero(struct semaphore *sem) +{ + int ret, tmp; + + __asm__ __volatile__( + "1:\tll\t%1,%2\n\t" + "blez\t%1,2f\n\t" + "subu\t%0,%1,1\n\t" + "sc\t%0,%2\n\t" + "beqz\t%0,1b\n\t" + "2:" + ".text" + : "=r"(ret), "=r"(tmp), "=m"(__atomic_fool_gcc(&sem->waking)) + : "0"(0)); + + return ret; +} + +/* + * waking_non_zero_interruptible: + * 1 got the lock + * 0 go to sleep + * -EINTR interrupted + * + * We must undo the sem->count down_interruptible decrement + * simultaneously and atomicly with the sem->waking adjustment, + * otherwise we can race with wake_one_more. + * + * This is accomplished by doing a 64-bit ll/sc on the 2 32-bit words. + * + * This is crazy. Normally it stricly forbidden to use 64-bit operation + * in the 32-bit MIPS kernel. In this case it's however ok because if an + * interrupt has destroyed the upper half of registers sc will fail. + */ +static inline int +waking_non_zero_interruptible(struct semaphore *sem, struct task_struct *tsk) +{ + long ret, tmp; + +#ifdef __MIPSEL__ + __asm__ __volatile__(" + .set mips3 + .set push + .set noat +0: lld %1,%2 + li %0,0 + + bltz %1, 1f + dli $1, 0xffffffff00000000 + daddu %1, $1 + li %0, 1 + b 2f +1: + + beqz %3, 1f + addiu $1, %1, 1 + dsll32 $1, $1, 0 + dsrl32 $1, $1, 0 + dsrl32 %1, %1, 0 + dsll32 %1, %1, 0 + or %1, $1 + li %0, %4 + b 2f +1: + scd %1, %2 +2: + beqz %1,0b + .set pop + .set mips0" + : "=&r"(ret), "=&r"(tmp), "=m"(*sem) + : "r"(signal_pending(tsk)), "i"(-EINTR)); +#endif + +#ifdef __MIPSEL__ +#error "FIXME: waking_non_zero_interruptible doesn't support little endian machines yet." +#endif + + return ret; +} + +/* + * waking_non_zero_trylock: + * 1 failed to lock + * 0 got the lock + * + * XXX SMP ALERT + */ +#ifdef __SMP__ +#error FIXME, waking_non_zero_trylock is broken for SMP. +#endif +static inline int waking_non_zero_trylock(struct semaphore *sem) +{ + int ret = 1; + + if (atomic_read(&sem->waking) <= 0) + atomic_inc(&sem->count); + else { + atomic_dec(&sem->waking); + ret = 0; + } + + return ret; +} + +#endif /* __ASM_MIPS_SEMAPHORE_HELPER_H */ diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h index b1ac4ecce..88c726546 100644 --- a/include/asm-mips/semaphore.h +++ b/include/asm-mips/semaphore.h @@ -25,42 +25,13 @@ struct semaphore { asmlinkage void __down(struct semaphore * sem); asmlinkage int __down_interruptible(struct semaphore * sem); +asmlinkage int __down_trylock(struct semaphore * sem); asmlinkage void __up(struct semaphore * sem); extern spinlock_t semaphore_wake_lock; #define sema_init(sem, val) atomic_set(&((sem)->count), val) -/* - * These two _must_ execute atomically wrt each other. - * - * This is trivially done with load_locked/store_cond, - * which we have. Let the rest of the losers suck eggs. - */ - -static inline void wake_one_more(struct semaphore * sem) -{ - atomic_inc(&sem->waking); -} - -static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) -{ - int ret, tmp; - - __asm__ __volatile__( - "1:\tll\t%1,%2\n" - "blez\t%1,2f\n\t" - "subu\t%0,%1,1\n\t" - "sc\t%0,%2\n\t" - "beqz\t%0,1b\n\t" - "2:" - ".text" - : "=r"(ret), "=r"(tmp), "=m"(__atomic_fool_gcc(&sem->waking)) - : "0"(0)); - - return ret; -} - extern inline void down(struct semaphore * sem) { if (atomic_dec_return(&sem->count) < 0) @@ -76,6 +47,50 @@ extern inline int down_interruptible(struct semaphore * sem) } /* + * down_trylock returns 0 on success, 1 if we failed to get the lock. + * + * We must manipulate count and waking simultaneously and atomically. + * Do this by using ll/sc on the pair of 32-bit words. + */ +extern inline int down_trylock(struct semaphore * sem) +{ + long ret, tmp, tmp2, sub; + +#ifdef __MIPSEB__ + __asm__ __volatile__(" + .set mips3 + 0: lld %1, %4 + dli %3, 0x0000000100000000 + sltu %0, %1, $0 + + bltz %1, 1f + move %3, $0 + 1: + + sltu %2, %1, $0 + and %0, %0, %2 + bnez %0, 2f + + subu %0, %3 + scd %1, %4 + + beqz %1, 0b + 2: + + .set mips0" + : "=&r"(ret), "=&r"(tmp), "=&r"(tmp2), "=&r"(sub) + : "m"(*sem) + : "memory"); +#endif + +#ifdef __MIPSEL__ +#error "FIXME: down_trylock doesn't support little endian machines yet." +#endif + + return ret; +} + +/* * Note! This is subtle. We jump to wake people up only if * the semaphore was negative (== somebody was waiting on it). */ diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h index eca5b65dd..5eb837e00 100644 --- a/include/asm-mips/siginfo.h +++ b/include/asm-mips/siginfo.h @@ -1,4 +1,4 @@ -/* $Id: siginfo.h,v 1.4 1998/08/28 16:23:06 ralf Exp $ +/* $Id: siginfo.h,v 1.3 1998/09/19 19:19:39 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -146,7 +146,7 @@ typedef struct siginfo { */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ -#define NSIGTRAP +#define NSIGTRAP 2 /* * SIGCHLD si_codes diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index 6e41a7635..d47580a11 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.8 1999/02/15 02:22:13 ralf Exp $ +/* $Id: system.h,v 1.9 1999/05/01 10:08:19 harald Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -134,12 +134,12 @@ __asm__ __volatile__( \ * switch_to(n) should switch tasks to task nr n, first * checking that n isn't the current task, in which case it does nothing. */ -extern asmlinkage void (*resume)(void *tsk); +extern asmlinkage void *(*resume)(void *last, void *next); #endif /* !defined (_LANGUAGE_ASSEMBLY) */ -#define switch_to(prev,next) \ +#define switch_to(prev,next,last) \ do { \ - resume(next); \ + (last) = resume(prev, next); \ } while(0) /* diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h index 62e3882a3..e06bde493 100644 --- a/include/asm-mips/termios.h +++ b/include/asm-mips/termios.h @@ -98,6 +98,7 @@ struct termio { #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ #ifdef __KERNEL__ diff --git a/include/asm-ppc/adb.h b/include/asm-ppc/adb.h index 58fcb8abe..c13b67bb5 100644 --- a/include/asm-ppc/adb.h +++ b/include/asm-ppc/adb.h @@ -21,6 +21,16 @@ #define ADB_RET_OK 0 #define ADB_RET_TIMEOUT 3 +/* The kind of ADB request. The controller may emulate some + of all of those CUDA/PMU packet kinds */ +#define ADB_PACKET 0 +#define CUDA_PACKET 1 +#define ERROR_PACKET 2 +#define TIMER_PACKET 3 +#define POWER_PACKET 4 +#define MACIIC_PACKET 5 +#define PMU_PACKET 6 + #ifdef __KERNEL__ struct adb_request { @@ -41,25 +51,50 @@ struct adb_ids { unsigned char id[16]; }; -extern enum adb_hw { - ADB_NONE, ADB_VIACUDA, ADB_VIAPMU, ADB_MACIO -} adb_hardware; +/* Messages sent thru the client_list notifier. You should NOT stop + the operation, at least not with this version */ +enum adb_message { + ADB_MSG_POWERDOWN, /* Currently called before sleep only */ + ADB_MSG_PRE_RESET, /* Called before resetting the bus */ + ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */ +}; +extern struct notifier_block *adb_client_list; + +/* Kind of ADB controller */ +enum adb_hw { + ADB_NONE, ADB_VIACUDA, ADB_VIAPMU, ADB_MACIO, ADB_UNKNOWN +}; -extern int (*adb_send_request)(struct adb_request *req, int sync); -extern int (*adb_autopoll)(int devs); -extern int (*adb_reset_bus)(void); +/* Definition of a controller */ +extern struct adb_controller { + enum adb_hw kind; + + int (*send_request)(struct adb_request *req, int sync); + int (*autopoll)(int devs); + int (*reset_bus)(void); + void (*poll)(void); +} *adb_controller; +extern enum adb_hw adb_hardware; /* Values for adb_request flags */ #define ADBREQ_REPLY 1 /* expect reply */ #define ADBREQ_SYNC 2 /* poll until done */ void adb_init(void); + int adb_request(struct adb_request *req, void (*done)(struct adb_request *), int flags, int nbytes, ...); int adb_register(int default_id,int handler_id,struct adb_ids *ids, void (*handler)(unsigned char *, int, struct pt_regs *, int)); void adb_input(unsigned char *, int, struct pt_regs *, int); +int adb_try_handler_change(int address, int new_id); +int adb_get_infos(int address, int *original_address, int *handler_id); + +int adb_reset_bus(void); + +void adb_poll(void); + #endif /* __KERNEL__ */ #endif /* __PPC_ADB_H */ diff --git a/include/asm-ppc/bootx.h b/include/asm-ppc/bootx.h index 85bea1469..ad69eaa54 100644 --- a/include/asm-ppc/bootx.h +++ b/include/asm-ppc/bootx.h @@ -18,7 +18,14 @@ #pragma options align=power #endif -#define BOOT_INFO_VERSION 1 +/* On boostrap entry: + * + * r3 = 0x426f6f58 ('BooX') + * r4 = pointer to boot_infos + * r5 = NULL + */ + +#define BOOT_INFO_VERSION 2 #define BOOT_INFO_COMPATIBLE_VERSION 1 /* Here are the boot informations that are passed to the bootstrap @@ -31,8 +38,12 @@ typedef struct boot_infos /* backward compatible down to version: */ unsigned long compatible_version; + /* NEW (vers. 2) this holds the current _logical_ base addr of + the frame buffer (for use by early boot message) */ + unsigned char* logicalDisplayBase; + /* Set to 0 by current BootX */ - unsigned long unused[3]; + unsigned long unused[2]; /* The device tree (internal addresses relative to the beginning of the tree, * device tree offset relative to the beginning of this structure). */ @@ -55,17 +66,18 @@ typedef struct boot_infos /* Kernel command line arguments (offset from this structure) */ unsigned long kernelParamsOffset; - + } boot_infos_t; /* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index is represented * by 3 short words containing a 16 bits (unsigned) color component. * Later versions may contain the gamma table for direct-color devices here. */ -#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL); +#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL) #ifdef macintosh #pragma options align=reset #endif #endif + diff --git a/include/asm-ppc/cache.h b/include/asm-ppc/cache.h index 431dc7a49..0d54430d2 100644 --- a/include/asm-ppc/cache.h +++ b/include/asm-ppc/cache.h @@ -13,7 +13,11 @@ #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) #define L1_CACHE_PAGES 8 +#define SMP_CACHE_BYTES L1_CACHE_BYTES + #if defined(__KERNEL__) && !defined(__ASSEMBLY__) +extern void flush_dcache_range(unsigned long start, unsigned long stop); + static inline unsigned long unlock_dcache(void) { #ifndef CONFIG_8xx diff --git a/include/asm-ppc/cuda.h b/include/asm-ppc/cuda.h index 2bfa7c127..39506f64a 100644 --- a/include/asm-ppc/cuda.h +++ b/include/asm-ppc/cuda.h @@ -5,15 +5,6 @@ * Copyright (C) 1996 Paul Mackerras. */ -/* First byte sent to or received from CUDA */ -#define ADB_PACKET 0 -#define CUDA_PACKET 1 -#define ERROR_PACKET 2 -#define TIMER_PACKET 3 -#define POWER_PACKET 4 -#define MACIIC_PACKET 5 -#define PMU_PACKET 6 - /* CUDA commands (2nd byte) */ #define CUDA_WARM_START 0 #define CUDA_AUTOPOLL 1 @@ -41,7 +32,7 @@ void find_via_cuda(void); void via_cuda_init(void); int cuda_request(struct adb_request *req, void (*done)(struct adb_request *), int nbytes, ...); -int cuda_send_request(struct adb_request *req); void cuda_poll(void); +int cuda_present(void); #endif /* __KERNEL */ diff --git a/include/asm-ppc/dma.h b/include/asm-ppc/dma.h index b817e055a..3e980e353 100644 --- a/include/asm-ppc/dma.h +++ b/include/asm-ppc/dma.h @@ -35,36 +35,9 @@ /* Doesn't really apply... */ #define MAX_DMA_ADDRESS 0xFFFFFFFF -#if defined(CONFIG_MACH_SPECIFIC) - -#if defined(CONFIG_PREP) -#define DMA_MODE_READ 0x44 -#define DMA_MODE_WRITE 0x48 -#define ISA_DMA_THRESHOLD 0x00ffffff -#endif /* CONFIG_PREP */ - -#if defined(CONFIG_CHRP) -#define DMA_MODE_READ 0x44 -#define DMA_MODE_WRITE 0x48 -#define ISA_DMA_THRESHOLD ~0L -#endif /* CONFIG_CHRP */ - -#ifdef CONFIG_PMAC -#define DMA_MODE_READ 1 -#define DMA_MODE_WRITE 2 -#define ISA_DMA_THRESHOLD ~0L -#endif /* CONFIG_PMAC */ - -#ifdef CONFIG_APUS -/* This is bogus and should go away. */ -#define ISA_DMA_THRESHOLD (0x00ffffff) -#endif - -#else /* in arch/ppc/kernel/setup.c -- Cort */ extern unsigned long DMA_MODE_WRITE, DMA_MODE_READ; extern unsigned long ISA_DMA_THRESHOLD; -#endif #ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER @@ -204,7 +177,7 @@ extern long ppc_cs4232_dma, ppc_cs4232_dma2; #define DMA2_EXT_REG 0x4D6 #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ -#define DMA_AUTOINIT 0x10 +#define DMA_AUTOINIT 0x10 extern spinlock_t dma_spin_lock; @@ -223,15 +196,47 @@ static __inline__ void release_dma_lock(unsigned long flags) /* enable/disable a specific DMA channel */ static __inline__ void enable_dma(unsigned int dmanr) { + /* + * The Radstone PPC2 and PPC2a boards have inverted DREQ + * lines (active low) so each command needs to be logically + * ORed with 0x40 + */ + unsigned char ucDmaCmd=0x00; + + if(_prep_type==_PREP_Radstone) + { + switch(ucSystemType) + { + case RS_SYS_TYPE_PPC2: + case RS_SYS_TYPE_PPC2a: + case RS_SYS_TYPE_PPC2ep: + { + /* + * DREQ lines are active low + */ + ucDmaCmd=0x40; + break; + } + + default: + { + /* + * DREQ lines are active high + */ + break; + } + } + } + if (dmanr != 4) { dma_outb(0, DMA2_MASK_REG); /* This may not be enabled */ - dma_outb(0, DMA2_CMD_REG); /* Enable group */ + dma_outb(ucDmaCmd, DMA2_CMD_REG); /* Enable group */ } if (dmanr<=3) { dma_outb(dmanr, DMA1_MASK_REG); - dma_outb(0, DMA1_CMD_REG); /* Enable group */ + dma_outb(ucDmaCmd, DMA1_CMD_REG); /* Enable group */ } else { dma_outb(dmanr & 3, DMA2_MASK_REG); @@ -395,9 +400,8 @@ extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a extern void free_dma(unsigned int dmanr); /* release it again */ #ifdef CONFIG_PCI_QUIRKS -extern int isa_dma_bridge_buggy; -#else -#define isa_dma_bridge_buggy (0) +extern int isa_dma_bridge_buggy; +#else +#define isa_dma_bridge_buggy (0) #endif - #endif /* _ASM_DMA_H */ diff --git a/include/asm-ppc/feature.h b/include/asm-ppc/feature.h index 4264690f8..28a31d945 100644 --- a/include/asm-ppc/feature.h +++ b/include/asm-ppc/feature.h @@ -35,7 +35,6 @@ enum system_feature { FEATURE_Mediabay_floppy_enable, FEATURE_BMac_reset, FEATURE_BMac_IO_enable, - FEATURE_Modem_PowerOn, FEATURE_Modem_Reset, FEATURE_last, }; diff --git a/include/asm-ppc/hardirq.h b/include/asm-ppc/hardirq.h index cc0db7259..cb195c5f7 100644 --- a/include/asm-ppc/hardirq.h +++ b/include/asm-ppc/hardirq.h @@ -1,22 +1,22 @@ #ifndef __ASM_HARDIRQ_H #define __ASM_HARDIRQ_H -extern unsigned int local_irq_count[NR_CPUS]; +extern unsigned int ppc_local_irq_count[NR_CPUS]; /* * Are we in an interrupt context? Either doing bottom half * or hardware interrupt processing? */ #define in_interrupt() ({ int __cpu = smp_processor_id(); \ - (local_irq_count[__cpu] + local_bh_count[__cpu] != 0); }) + (ppc_local_irq_count[__cpu] + ppc_local_bh_count[__cpu] != 0); }) #ifndef __SMP__ -#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) +#define hardirq_trylock(cpu) (ppc_local_irq_count[cpu] == 0) #define hardirq_endlock(cpu) do { } while (0) -#define hardirq_enter(cpu) (local_irq_count[cpu]++) -#define hardirq_exit(cpu) (local_irq_count[cpu]--) +#define hardirq_enter(cpu) (ppc_local_irq_count[cpu]++) +#define hardirq_exit(cpu) (ppc_local_irq_count[cpu]--) #define synchronize_irq() do { } while (0) @@ -39,14 +39,14 @@ static inline void release_irqlock(int cpu) static inline void hardirq_enter(int cpu) { - ++local_irq_count[cpu]; + ++ppc_local_irq_count[cpu]; atomic_inc(&global_irq_count); } static inline void hardirq_exit(int cpu) { atomic_dec(&global_irq_count); - --local_irq_count[cpu]; + --ppc_local_irq_count[cpu]; } static inline int hardirq_trylock(int cpu) diff --git a/include/asm-ppc/ide.h b/include/asm-ppc/ide.h index cad526b12..c53267b77 100644 --- a/include/asm-ppc/ide.h +++ b/include/asm-ppc/ide.h @@ -11,61 +11,20 @@ #ifndef __ASMPPC_IDE_H #define __ASMPPC_IDE_H -#include <linux/config.h> -#ifdef CONFIG_APUS -#include <linux/hdreg.h> - -#define ide_init_hwif_ports m68k_ide_init_hwif_ports -#include <asm-m68k/ide.h> -#undef ide_init_hwif_ports -#undef insw - -void ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); -void ide_insw(ide_ioreg_t port, void *buf, int ns); -void ide_outsw(ide_ioreg_t port, void *buf, int ns); -#define insw(port, buf, ns) do { \ - if ( _machine != _MACH_Pmac && _machine != _MACH_apus ) \ - /* this must be the same as insw in io.h!! */ \ - _insw((unsigned short *)((port)+_IO_BASE), (buf), (ns)); \ - else \ - ide_insw((port), (buf), (ns)); \ -} while (0) -#undef outsw -#define outsw(port, buf, ns) do { \ - if ( _machine != _MACH_Pmac && _machine != _MACH_apus ) \ - /* this must be the same as outsw in io.h!! */ \ - _outsw((unsigned short *)((port)+_IO_BASE), (buf), (ns)); \ - else \ - ide_outsw((port), (buf), (ns)); \ -} while (0) -#else /* CONFIG_APUS */ - -#ifdef __KERNEL__ - -#include <linux/hdreg.h> -#include <linux/ioport.h> -#include <asm/io.h> /* so we can redefine insw/outsw */ +#include <linux/sched.h> +#include <asm/processor.h> #ifndef MAX_HWIFS #define MAX_HWIFS 4 #endif -#undef SUPPORT_SLOW_DATA_PORTS -#define SUPPORT_SLOW_DATA_PORTS 0 -#undef SUPPORT_VLB_SYNC -#define SUPPORT_VLB_SYNC 0 - +typedef unsigned int ide_ioreg_t; -#define ide__sti() __sti() +#ifdef __KERNEL__ -typedef unsigned int ide_ioreg_t; -void ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); -void prep_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); -void mbx_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); -void pmac_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); -void chrp_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); -void ide_insw(ide_ioreg_t port, void *buf, int ns); -void ide_outsw(ide_ioreg_t port, void *buf, int ns); +#include <linux/hdreg.h> +#include <linux/ioport.h> +#include <asm/io.h> extern int pmac_ide_ports_known; extern ide_ioreg_t pmac_ide_regbase[MAX_HWIFS]; @@ -78,222 +37,86 @@ extern ide_ioreg_t chrp_idedma_regbase; /* one for both channels */ extern unsigned int chrp_ide_irq; extern void chrp_ide_probe(void); +struct ide_machdep_calls { + void (*insw)(ide_ioreg_t port, void *buf, int ns); + void (*outsw)(ide_ioreg_t port, void *buf, int ns); + int (*default_irq)(ide_ioreg_t base); + ide_ioreg_t (*default_io_base)(int index); + int (*check_region)(ide_ioreg_t from, unsigned int extent); + void (*request_region)(ide_ioreg_t from, + unsigned int extent, + const char *name); + void (*release_region)(ide_ioreg_t from, + unsigned int extent); + void (*fix_driveid)(struct hd_driveid *id); + void (*ide_init_hwif)(ide_ioreg_t *p, + ide_ioreg_t base, + int *irq); + + int io_base; +}; + +extern struct ide_machdep_calls ppc_ide_md; + +void ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq); +void ide_insw(ide_ioreg_t port, void *buf, int ns); +void ide_outsw(ide_ioreg_t port, void *buf, int ns); +void ppc_generic_ide_fix_driveid(struct hd_driveid *id); + +#undef insw +#define insw(port, buf, ns) do { \ + ppc_ide_md.insw((port), (buf), (ns)); \ +} while (0) + +#undef outsw +#define outsw(port, buf, ns) do { \ + ppc_ide_md.outsw((port), (buf), (ns)); \ +} while (0) + +#undef SUPPORT_SLOW_DATA_PORTS +#define SUPPORT_SLOW_DATA_PORTS 0 +#undef SUPPORT_VLB_SYNC +#define SUPPORT_VLB_SYNC 0 + +#define ide__sti() __sti() + static __inline__ int ide_default_irq(ide_ioreg_t base) { - if ( _machine == _MACH_Pmac ) - return 0; - else if ( _machine == _MACH_mbx ) - /* hardcode IRQ 14 on the MBX */ - return 14+16; - else if ( _machine == _MACH_chrp) { - if (chrp_ide_ports_known == 0) - chrp_ide_probe(); - return chrp_ide_irq; - } - switch (base) { - case 0x1f0: return 13; - case 0x170: return 13; - case 0x1e8: return 11; - case 0x168: return 10; - default: - return 0; - } + return ppc_ide_md.default_irq(base); } static __inline__ ide_ioreg_t ide_default_io_base(int index) { -#if defined(CONFIG_BLK_DEV_IDE_PMAC) - if (_machine == _MACH_Pmac) { - return pmac_ide_regbase[index]; - } -#endif - if (_machine == _MACH_mbx) return index; - if ( _machine == _MACH_chrp ) { - if (chrp_ide_ports_known == 0) - chrp_ide_probe(); - return chrp_ide_regbase[index]; - } - switch (index) { - case 0: return 0x1f0; - case 1: return 0x170; - case 2: return 0x1e8; - case 3: return 0x168; - default: - return 0; - } + return ppc_ide_md.default_io_base(index); } static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent) { - if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx)) - return 0; - return check_region(from, extent); + return ppc_ide_md.check_region(from, extent); } static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name) { - if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) - return; - request_region(from, extent, name); + ppc_ide_md.request_region(from, extent, name); } static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent) { - if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) - return; - release_region(from, extent); + ppc_ide_md.release_region(from, extent); } -/* Convert the shorts/longs in hd_driveid from little to big endian; - chars are endian independent, of course, but strings need to be flipped. - (Despite what it says in drivers/block/ide.h, they come up as little endian...) - Changes to linux/hdreg.h may require changes here. */ static __inline__ void ide_fix_driveid (struct hd_driveid *id) { - if (( _machine == _MACH_Pmac ) || (_machine == _MACH_chrp)|| (_machine == _MACH_mbx) ) { - int i; - unsigned short *stringcast; - id->config = __le16_to_cpu(id->config); - id->cyls = __le16_to_cpu(id->cyls); - id->reserved2 = __le16_to_cpu(id->reserved2); - id->heads = __le16_to_cpu(id->heads); - id->track_bytes = __le16_to_cpu(id->track_bytes); - id->sector_bytes = __le16_to_cpu(id->sector_bytes); - id->sectors = __le16_to_cpu(id->sectors); - id->vendor0 = __le16_to_cpu(id->vendor0); - id->vendor1 = __le16_to_cpu(id->vendor1); - id->vendor2 = __le16_to_cpu(id->vendor2); - stringcast = (unsigned short *)&id->serial_no[0]; - for (i=0; i<(20/2); i++) - stringcast[i] = __le16_to_cpu(stringcast[i]); - id->buf_type = __le16_to_cpu(id->buf_type); - id->buf_size = __le16_to_cpu(id->buf_size); - id->ecc_bytes = __le16_to_cpu(id->ecc_bytes); - stringcast = (unsigned short *)&id->fw_rev[0]; - for (i=0; i<(8/2); i++) - stringcast[i] = __le16_to_cpu(stringcast[i]); - stringcast = (unsigned short *)&id->model[0]; - for (i=0; i<(40/2); i++) - stringcast[i] = __le16_to_cpu(stringcast[i]); - id->dword_io = __le16_to_cpu(id->dword_io); - id->reserved50 = __le16_to_cpu(id->reserved50); - id->field_valid = __le16_to_cpu(id->field_valid); - id->cur_cyls = __le16_to_cpu(id->cur_cyls); - id->cur_heads = __le16_to_cpu(id->cur_heads); - id->cur_sectors = __le16_to_cpu(id->cur_sectors); - id->cur_capacity0 = __le16_to_cpu(id->cur_capacity0); - id->cur_capacity1 = __le16_to_cpu(id->cur_capacity1); - id->lba_capacity = __le32_to_cpu(id->lba_capacity); - id->dma_1word = __le16_to_cpu(id->dma_1word); - id->dma_mword = __le16_to_cpu(id->dma_mword); - id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes); - id->eide_dma_min = __le16_to_cpu(id->eide_dma_min); - id->eide_dma_time = __le16_to_cpu(id->eide_dma_time); - id->eide_pio = __le16_to_cpu(id->eide_pio); - id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy); - id->word69 = __le16_to_cpu(id->word69); - id->word70 = __le16_to_cpu(id->word70); - id->word71 = __le16_to_cpu(id->word71); - id->word72 = __le16_to_cpu(id->word72); - id->word73 = __le16_to_cpu(id->word73); - id->word74 = __le16_to_cpu(id->word74); - id->word75 = __le16_to_cpu(id->word75); - id->word76 = __le16_to_cpu(id->word76); - id->word77 = __le16_to_cpu(id->word77); - id->word78 = __le16_to_cpu(id->word78); - id->word79 = __le16_to_cpu(id->word79); - id->word80 = __le16_to_cpu(id->word80); - id->word81 = __le16_to_cpu(id->word81); - id->command_sets = __le16_to_cpu(id->command_sets); - id->word83 = __le16_to_cpu(id->word83); - id->word84 = __le16_to_cpu(id->word84); - id->word85 = __le16_to_cpu(id->word85); - id->word86 = __le16_to_cpu(id->word86); - id->word87 = __le16_to_cpu(id->word87); - id->dma_ultra = __le16_to_cpu(id->dma_ultra); - id->word89 = __le16_to_cpu(id->word89); - id->word90 = __le16_to_cpu(id->word90); - id->word91 = __le16_to_cpu(id->word91); - id->word92 = __le16_to_cpu(id->word92); - id->word93 = __le16_to_cpu(id->word93); - id->word94 = __le16_to_cpu(id->word94); - id->word95 = __le16_to_cpu(id->word95); - id->word96 = __le16_to_cpu(id->word96); - id->word97 = __le16_to_cpu(id->word97); - id->word98 = __le16_to_cpu(id->word98); - id->word99 = __le16_to_cpu(id->word99); - id->word100 = __le16_to_cpu(id->word100); - id->word101 = __le16_to_cpu(id->word101); - id->word102 = __le16_to_cpu(id->word102); - id->word103 = __le16_to_cpu(id->word103); - id->word104 = __le16_to_cpu(id->word104); - id->word105 = __le16_to_cpu(id->word105); - id->word106 = __le16_to_cpu(id->word106); - id->word107 = __le16_to_cpu(id->word107); - id->word108 = __le16_to_cpu(id->word108); - id->word109 = __le16_to_cpu(id->word109); - id->word110 = __le16_to_cpu(id->word110); - id->word111 = __le16_to_cpu(id->word111); - id->word112 = __le16_to_cpu(id->word112); - id->word113 = __le16_to_cpu(id->word113); - id->word114 = __le16_to_cpu(id->word114); - id->word115 = __le16_to_cpu(id->word115); - id->word116 = __le16_to_cpu(id->word116); - id->word117 = __le16_to_cpu(id->word117); - id->word118 = __le16_to_cpu(id->word118); - id->word119 = __le16_to_cpu(id->word119); - id->word120 = __le16_to_cpu(id->word120); - id->word121 = __le16_to_cpu(id->word121); - id->word122 = __le16_to_cpu(id->word122); - id->word123 = __le16_to_cpu(id->word123); - id->word124 = __le16_to_cpu(id->word124); - id->word125 = __le16_to_cpu(id->word125); - id->word126 = __le16_to_cpu(id->word126); - id->word127 = __le16_to_cpu(id->word127); - id->security = __le16_to_cpu(id->security); - for (i=0; i<127; i++) - id->reserved[i] = __le16_to_cpu(id->reserved[i]); - } + ppc_ide_md.fix_driveid(id); } -#undef insw -#define insw(port, buf, ns) do { \ - if ( _machine == _MACH_chrp) {\ - ide_insw((port)+_IO_BASE, (buf), (ns)); \ - }\ - else if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) \ - ide_insw((port)+((_machine==_MACH_mbx)? 0x80000000: 0), \ - (buf), (ns)); \ - else \ - /* this must be the same as insw in io.h!! */ \ - _insw((unsigned short *)((port)+_IO_BASE), (buf), (ns)); \ -} while (0) -#undef outsw -/* printk("port: %x buf: %p ns: %d\n",port,buf,ns); \ */ -#define outsw(port, buf, ns) do { \ - if ( _machine == _MACH_chrp) {\ - ide_outsw((port)+_IO_BASE, (buf), (ns)); \ - }\ - else if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) \ - ide_outsw((port)+((_machine==_MACH_mbx)? 0x80000000: 0), \ - (buf), (ns)); \ - else \ - /* this must be the same as outsw in io.h!! */ \ - _outsw((unsigned short *)((port)+_IO_BASE), (buf), (ns)); \ -} while (0) - #undef inb -#define inb(port) \ - in_8((unsigned char *)((port) + \ - ((_machine==_MACH_Pmac)? 0: _IO_BASE) + \ - ((_machine==_MACH_mbx)? 0x80000000: 0)) ) +#define inb(port) in_8((unsigned char *)((port) + ppc_ide_md.io_base)) #undef inb_p #define inb_p(port) inb(port) #undef outb #define outb(val, port) \ - out_8((unsigned char *)((port) + \ - ((_machine==_MACH_Pmac)? 0: _IO_BASE) + \ - ((_machine==_MACH_mbx)? 0x80000000: 0)), (val) ) + out_8((unsigned char *)((port) + ppc_ide_md.io_base), (val) ) #undef outb_p #define outb_p(val, port) outb(val, port) @@ -327,6 +150,5 @@ static __inline__ void ide_free_irq(unsigned int irq, void *dev_id) #define ide_get_lock(lock, hdlr, data) do {} while (0) #endif /* __KERNEL__ */ -#endif /* CONFIG_APUS */ #endif /* __ASMPPC_IDE_H */ diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index b6b80c4ea..92ac97729 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -5,19 +5,9 @@ #include <asm/page.h> #include <asm/byteorder.h> -#define KERNELBASE 0xc0000000 - -/* from the Carolina Technical Spec -- Cort */ -#define IBM_ACORN 0x82A #define SIO_CONFIG_RA 0x398 #define SIO_CONFIG_RD 0x399 -#define IBM_HDD_LED 0x808 -#define IBM_EQUIP_PRESENT 0x80c -#define IBM_L2_STATUS 0x80d -#define IBM_L2_INVALIDATE 0x814 -#define IBM_SYS_CTL 0x81c - #define SLOW_DOWN_IO #define PMAC_ISA_MEM_BASE 0 @@ -26,12 +16,11 @@ #define CHRP_ISA_MEM_BASE 0xf7000000 #define CHRP_PCI_DRAM_OFFSET 0 #define PREP_ISA_IO_BASE 0x80000000 -#define PREP_ISA_MEM_BASE 0xd0000000 -/*#define PREP_ISA_MEM_BASE 0xc0000000*/ +#define PREP_ISA_MEM_BASE 0xc0000000 #define PREP_PCI_DRAM_OFFSET 0x80000000 #ifdef CONFIG_MBX -#define _IO_BASE 0 +#define _IO_BASE 0x80000000 #define _ISA_MEM_BASE 0 #define PCI_DRAM_OFFSET 0x80000000 #else /* CONFIG_MBX8xx */ @@ -58,7 +47,7 @@ extern unsigned long pci_dram_offset; #define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) #else #define readw(addr) in_le16((volatile unsigned short *)(addr)) -#define readl(addr) in_le32((volatile unsigned *)addr) +#define readl(addr) in_le32((volatile unsigned *)(addr)) #define writew(b,addr) out_le16((volatile unsigned short *)(addr),(b)) #define writel(b,addr) out_le32((volatile unsigned *)(addr),(b)) #endif diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index 661b2c007..3a32490b5 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h @@ -3,7 +3,10 @@ #ifndef _ASM_IRQ_H #define _ASM_IRQ_H -#include <asm/processor.h> /* for is_prep() */ +#include <asm/machdep.h> /* ppc_md */ + +extern void disable_irq(unsigned int); +extern void enable_irq(unsigned int); #ifndef CONFIG_8xx @@ -31,9 +34,6 @@ #define irq_to_openpic(n) ((n)-NUM_8259_INTERRUPTS) #define IRQ_8259_CASCADE NUM_8259_INTERRUPTS -extern void disable_irq(unsigned int); -extern void enable_irq(unsigned int); - #ifndef CONFIG_APUS /* * This gets called from serial.c, which is now used on @@ -42,7 +42,14 @@ extern void enable_irq(unsigned int); */ static __inline__ int irq_cannonicalize(int irq) { - return (((is_prep || is_chrp) && irq == 2) ? 9 : irq); + if (ppc_md.irq_cannonicalize) + { + return ppc_md.irq_cannonicalize(irq); + } + else + { + return irq; + } } #endif @@ -54,28 +61,26 @@ static __inline__ int irq_cannonicalize(int irq) * There are eight external interrupts (IRQs) that can be configured * as either level or edge sensitive. * On the MBX implementation, there is also the possibility of an 8259 - * through the PCI and PCI-ISA bridges. All 8259 interrupts appear - * on the 8xx as IRQ3, but I may eventually add some of the 8259 code - * back into this port to handle that controller. + * through the PCI and PCI-ISA bridges. */ -#define NR_IRQS 16 - -#define SIU_IRQ0 0 /* Highest priority */ -#define SIU_LEVEL0 1 -#define SIU_IRQ1 2 -#define SIU_LEVEL1 3 -#define SIU_IRQ2 4 -#define SIU_LEVEL2 5 -#define SIU_IRQ3 6 -#define SIU_LEVEL3 7 -#define SIU_IRQ4 8 -#define SIU_LEVEL4 9 -#define SIU_IRQ5 10 -#define SIU_LEVEL5 11 -#define SIU_IRQ6 12 -#define SIU_LEVEL6 13 -#define SIU_IRQ7 14 -#define SIU_LEVEL7 15 +#define NR_IRQS (16+16) /* 8259 has 16, too -- Cort */ + +#define SIU_IRQ0 (0+16) /* Highest priority */ +#define SIU_LEVEL0 (1+16) +#define SIU_IRQ1 (2+16) +#define SIU_LEVEL1 (3+16) +#define SIU_IRQ2 (4+16) +#define SIU_LEVEL2 (5+16) +#define SIU_IRQ3 (6+16) +#define SIU_LEVEL3 (7+16) +#define SIU_IRQ4 (8+16) +#define SIU_LEVEL4 (9+16) +#define SIU_IRQ5 (10+16) +#define SIU_LEVEL5 (11+16) +#define SIU_IRQ6 (12+16) +#define SIU_LEVEL6 (13+16) +#define SIU_IRQ7 (14+16) +#define SIU_LEVEL7 (15+16) /* The internal interrupts we can configure as we see fit. * My personal preference is CPM at level 2, which puts it above the diff --git a/include/asm-ppc/keyboard.h b/include/asm-ppc/keyboard.h index 7b40d6100..0f618fbae 100644 --- a/include/asm-ppc/keyboard.h +++ b/include/asm-ppc/keyboard.h @@ -3,7 +3,7 @@ * * Created 3 Nov 1996 by Geert Uytterhoeven * - * $Id: keyboard.h,v 1.6 1998/08/20 14:41:03 ralf Exp $ + * $Id: keyboard.h,v 1.9 1999/06/10 10:08:56 ralf Exp $ * Modified for Power Macintosh by Paul Mackerras */ @@ -21,7 +21,7 @@ #include <linux/config.h> #include <asm/adb.h> - +#include <asm/machdep.h> #ifdef CONFIG_APUS #include <asm-m68k/keyboard.h> #else @@ -30,151 +30,44 @@ #define DISABLE_KBD_DURING_INTERRUPTS 0 #define INIT_KBD -extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode); -extern int mackbd_getkeycode(unsigned int scancode); -extern int mackbd_pretranslate(unsigned char scancode, char raw_mode); -extern int mackbd_translate(unsigned char scancode, unsigned char *keycode, - char raw_mode); -extern int mackbd_unexpected_up(unsigned char keycode); -extern void mackbd_leds(unsigned char leds); -extern void mackbd_init_hw(void); - -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); -extern int pckbd_getkeycode(unsigned int scancode); -extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, - char raw_mode); -extern char pckbd_unexpected_up(unsigned char keycode); -extern void pckbd_leds(unsigned char leds); -extern void pckbd_init_hw(void); - static inline int kbd_setkeycode(unsigned int scancode, unsigned int keycode) { - if ( is_prep ) - return pckbd_setkeycode(scancode,keycode); - else if ( is_chrp ) -#ifndef CONFIG_MAC_KEYBOARD - return pckbd_setkeycode(scancode,keycode); -#else - /* I'm not actually sure if it's legal to have a CHRP machine - * without an ADB controller. In any case, this should really - * be changed to be a test to see if an ADB _keyboard_ exists - * (not just a controller), but that's another story for - * another night. - */ - if ( adb_hardware == ADB_NONE ) - return pckbd_setkeycode(scancode,keycode); - else - return mackbd_setkeycode(scancode,keycode); -#endif - else - return mackbd_setkeycode(scancode,keycode); + return ppc_md.kbd_setkeycode(scancode, keycode); } -static inline int kbd_getkeycode(unsigned int x) +static inline int kbd_getkeycode(unsigned int scancode) { - if ( is_prep ) - return pckbd_getkeycode(x); - else if ( is_chrp ) -#ifndef CONFIG_MAC_KEYBOARD - return pckbd_getkeycode(x); -#else - if ( adb_hardware == ADB_NONE ) - return pckbd_getkeycode(x); - else - return mackbd_getkeycode(x); -#endif - else - return mackbd_getkeycode(x); -} - -static inline int kbd_pretranslate(unsigned char x,char y) -{ - if ( is_prep ) - return pckbd_pretranslate(x,y); - else if ( is_chrp ) -#ifndef CONFIG_MAC_KEYBOARD - return pckbd_pretranslate(x,y); -#else - if ( adb_hardware == ADB_NONE ) - return pckbd_pretranslate(x,y); - else - return mackbd_pretranslate(x,y); -#endif - else - return mackbd_pretranslate(x,y); + return ppc_md.kbd_getkeycode(scancode); } static inline int kbd_translate(unsigned char keycode, unsigned char *keycodep, - char raw_mode) + char raw_mode) { - if ( is_prep ) - return pckbd_translate(keycode,keycodep,raw_mode); - else if ( is_chrp ) -#ifndef CONFIG_MAC_KEYBOARD - return pckbd_translate(keycode,keycodep,raw_mode); -#else - if ( adb_hardware == ADB_NONE ) - return pckbd_translate(keycode,keycodep,raw_mode); - else - return mackbd_translate(keycode,keycodep,raw_mode); -#endif - else - return mackbd_translate(keycode,keycodep,raw_mode); - + return ppc_md.kbd_translate(keycode, keycodep, raw_mode); } static inline int kbd_unexpected_up(unsigned char keycode) { - if ( is_prep ) - return pckbd_unexpected_up(keycode); - else if ( is_chrp ) -#ifndef CONFIG_MAC_KEYBOARD - return pckbd_unexpected_up(keycode); -#else - if ( adb_hardware == ADB_NONE ) - return pckbd_unexpected_up(keycode); - else - return mackbd_unexpected_up(keycode); -#endif - else - return mackbd_unexpected_up(keycode); - + return ppc_md.kbd_unexpected_up(keycode); } static inline void kbd_leds(unsigned char leds) { - if ( is_prep ) - pckbd_leds(leds); - else if ( is_chrp ) -#ifndef CONFIG_MAC_KEYBOARD - pckbd_leds(leds); -#else - if ( adb_hardware == ADB_NONE ) - pckbd_leds(leds); - else - mackbd_leds(leds); -#endif - else - mackbd_leds(leds); + ppc_md.kbd_leds(leds); } static inline void kbd_init_hw(void) { - if ( is_prep ) - pckbd_init_hw(); - else if ( is_chrp ) -#ifndef CONFIG_MAC_KEYBOARD - pckbd_init_hw(); + ppc_md.kbd_init_hw(); +} + +#define kbd_sysrq_xlate (ppc_md.kbd_sysrq_xlate) + +#ifdef CONFIG_MAC_KEYBOARD +# define SYSRQ_KEY 0x69 #else - if ( adb_hardware == ADB_NONE ) - pckbd_init_hw(); - else - mackbd_init_hw(); +# define SYSRQ_KEY 0x54 #endif - else - mackbd_init_hw(); -} #endif /* CONFIG_APUS */ diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h index 65d53cb38..78f35e285 100644 --- a/include/asm-ppc/machdep.h +++ b/include/asm-ppc/machdep.h @@ -1,3 +1,4 @@ + #ifndef _PPC_MACHDEP_H #define _PPC_MACHDEP_H @@ -7,6 +8,69 @@ #include <asm-m68k/machdep.h> #endif -#endif /* _PPC_MACHDEP_H */ +struct pt_regs; + +struct machdep_calls { + void (*setup_arch)(unsigned long * memory_start_p, + unsigned long * memory_end_p); + /* Optional, may be NULL. */ + int (*setup_residual)(char *buffer); + /* Optional, may be NULL. */ + int (*get_cpuinfo)(char *buffer); + /* Optional, may be NULL. */ + unsigned int (*irq_cannonicalize)(unsigned int irq); + void (*init_IRQ)(void); + void (*do_IRQ)(struct pt_regs *regs, int cpu, int isfake); + + /* A general init function, called by ppc_init in init/main.c. + May be NULL. */ + void (*init)(void); + + void (*restart)(char *cmd); + void (*power_off)(void); + void (*halt)(void); + + void (*time_init)(void); /* Optional, may be NULL */ + int (*set_rtc_time)(unsigned long nowtime); + unsigned long (*get_rtc_time)(void); + void (*calibrate_decr)(void); + unsigned char (*nvram_read_val)(int addr); + void (*nvram_write_val)(int addr, unsigned char val); +/* Tons of keyboard stuff. */ + int (*kbd_setkeycode)(unsigned int scancode, + unsigned int keycode); + int (*kbd_getkeycode)(unsigned int scancode); + int (*kbd_translate)(unsigned char scancode, + unsigned char *keycode, + char raw_mode); + char (*kbd_unexpected_up)(unsigned char keycode); + void (*kbd_leds)(unsigned char leds); + void (*kbd_init_hw)(void); +#ifdef CONFIG_MAGIC_SYSRQ + unsigned char *kbd_sysrq_xlate; +#endif + + /* PCI interfaces */ + int (*pcibios_read_config_byte)(unsigned char bus, + unsigned char dev_fn, unsigned char offset, unsigned char *val); + int (*pcibios_read_config_word)(unsigned char bus, + unsigned char dev_fn, unsigned char offset, unsigned short *val); + int (*pcibios_read_config_dword)(unsigned char bus, + unsigned char dev_fn, unsigned char offset, unsigned int *val); + int (*pcibios_write_config_byte)(unsigned char bus, + unsigned char dev_fn, unsigned char offset, unsigned char val); + int (*pcibios_write_config_word)(unsigned char bus, + unsigned char dev_fn, unsigned char offset, unsigned short val); + int (*pcibios_write_config_dword)(unsigned char bus, + unsigned char dev_fn, unsigned char offset, unsigned int val); + void (*pcibios_fixup)(void); +}; + +extern struct machdep_calls ppc_md; +extern char cmd_line[512]; + +extern void setup_pci_ptrs(void); + +#endif /* _PPC_MACHDEP_H */ diff --git a/include/asm-ppc/mk48t59.h b/include/asm-ppc/mk48t59.h new file mode 100644 index 000000000..4700fcdc8 --- /dev/null +++ b/include/asm-ppc/mk48t59.h @@ -0,0 +1,35 @@ +/* + * Registers for the mk48t59 real-time-clock + */ + +#ifndef _PPC_MK48T59_H +#define _PPC_MK48T59_H + +/* RTC Offsets */ + +#define MK48T59_RTC_SECONDS 0x1FF9 +#define MK48T59_RTC_MINUTES 0x1FFA +#define MK48T59_RTC_HOURS 0x1FFB +#define MK48T59_RTC_DAY_OF_WEEK 0x1FFC +#define MK48T59_RTC_DAY_OF_MONTH 0x1FFD +#define MK48T59_RTC_MONTH 0x1FFE +#define MK48T59_RTC_YEAR 0x1FFF + +#define MK48T59_RTC_CONTROLA 0x1FF8 +#define MK48T59_RTC_CA_WRITE 0x80 +#define MK48T59_RTC_CA_READ 0x40 +#define MK48T59_RTC_CA_CALIB_SIGN 0x20 +#define MK48T59_RTC_CA_CALIB_MASK 0x1f + +#define MK48T59_RTC_CONTROLB 0x1FF9 +#define MK48T59_RTC_CB_STOP 0x80 + +#ifndef BCD_TO_BIN +#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) +#endif + +#ifndef BIN_TO_BCD +#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) +#endif + +#endif /* _PPC_MK48T59_H */ diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index 81ced8229..f77ef3df4 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h @@ -88,25 +88,6 @@ typedef struct _P601_BAT { P601_BATL batl; /* Lower register */ } P601_BAT; -/* Block size masks */ -#define BL_128K 0x000 -#define BL_256K 0x001 -#define BL_512K 0x003 -#define BL_1M 0x007 -#define BL_2M 0x00F -#define BL_4M 0x01F -#define BL_8M 0x03F -#define BL_16M 0x07F -#define BL_32M 0x0FF -#define BL_64M 0x1FF -#define BL_128M 0x3FF -#define BL_256M 0x7FF - -/* BAT Access Protection */ -#define BPP_XX 0x00 /* No access */ -#define BPP_RX 0x01 /* Read only */ -#define BPP_RW 0x02 /* Read/write */ - /* * Simulated two-level MMU. This structure is used by the kernel * to keep track of MMU mappings and is used to update/maintain @@ -135,6 +116,35 @@ typedef struct _MMU_context { pte **pmap; /* Two-level page-map structure */ } MMU_context; +/* invalidate a TLB entry */ +extern inline void _tlbie(unsigned long va) +{ + asm volatile ("tlbie %0" : : "r"(va)); +} + +extern void _tlbia(void); /* invalidate all TLB entries */ + +#endif /* __ASSEMBLY__ */ + +/* Block size masks */ +#define BL_128K 0x000 +#define BL_256K 0x001 +#define BL_512K 0x003 +#define BL_1M 0x007 +#define BL_2M 0x00F +#define BL_4M 0x01F +#define BL_8M 0x03F +#define BL_16M 0x07F +#define BL_32M 0x0FF +#define BL_64M 0x1FF +#define BL_128M 0x3FF +#define BL_256M 0x7FF + +/* BAT Access Protection */ +#define BPP_XX 0x00 /* No access */ +#define BPP_RX 0x01 /* Read only */ +#define BPP_RW 0x02 /* Read/write */ + /* Used to set up SDR1 register */ #define HASH_TABLE_SIZE_64K 0x00010000 #define HASH_TABLE_SIZE_128K 0x00020000 @@ -151,15 +161,6 @@ typedef struct _MMU_context { #define HASH_TABLE_MASK_2M 0x01F #define HASH_TABLE_MASK_4M 0x03F -/* invalidate a TLB entry */ -extern inline void _tlbie(unsigned long va) -{ - asm volatile ("tlbie %0" : : "r"(va)); -} - -extern void _tlbia(void); /* invalidate all TLB entries */ -#endif /* __ASSEMBLY__ */ - /* Control/status registers for the MPC8xx. * A write operation to these registers causes serialized access. * During software tablewalk, the registers used perform mask/shift-add diff --git a/include/asm-ppc/ohare.h b/include/asm-ppc/ohare.h index 094ad05b1..c022e5034 100644 --- a/include/asm-ppc/ohare.h +++ b/include/asm-ppc/ohare.h @@ -22,8 +22,8 @@ #define OH_SCC_ENABLE 0x200 #define OH_MESH_ENABLE 0x400 #define OH_FLOPPY_ENABLE 0x800 -#define OH_SCCA_IO 0x2000 -#define OH_SCCB_IO 0x4000 +#define OH_SCCA_IO 0x4000 +#define OH_SCCB_IO 0x8000 #define OH_VIA_ENABLE 0x10000 #define OH_IDECD_POWER 0x800000 diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h index 77fe08f4a..12e576e85 100644 --- a/include/asm-ppc/page.h +++ b/include/asm-ppc/page.h @@ -9,7 +9,7 @@ #define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_OFFSET 0xc0000000 - +#define KERNELBASE PAGE_OFFSET #ifndef __ASSEMBLY__ #ifdef __KERNEL__ @@ -63,9 +63,9 @@ typedef unsigned long pgprot_t; /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) - -#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) +extern void clear_page(unsigned long page); #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) + /* map phys->virtual and virtual->phys for RAM pages */ #ifdef CONFIG_APUS #include <asm/amigappc.h> diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 9e8e36d60..2c481490e 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -37,6 +37,7 @@ extern void flush_page_to_ram(unsigned long); extern unsigned long va_to_phys(unsigned long address); extern pte_t *va_to_pte(struct task_struct *tsk, unsigned long address); +extern unsigned long ioremap_bot, ioremap_base; #endif /* __ASSEMBLY__ */ /* * The PowerPC MMU uses a hash table containing PTEs, together with @@ -95,16 +96,19 @@ extern pte_t *va_to_pte(struct task_struct *tsk, unsigned long address); * The vmalloc() routines leaves a hole of 4kB between each vmalloced * area for the same reason. ;) * - * The vmalloc_offset MUST be larger than the gap between the bat2 mapping - * and the size of physical ram. Since the bat2 mapping can be larger than - * the amount of ram we have vmalloc_offset must ensure that we don't try - * to allocate areas that don't exist! This value of 64M will only cause - * problems when we have >128M -- Cort + * We no longer map larger than phys RAM with the BATs so we don't have + * to worry about the VMALLOC_OFFSET causing problems. We do have to worry + * about clashes between our early calls to ioremap() that start growing down + * from ioremap_base being run into the VM area allocations (growing upwards + * from VMALLOC_START). For this reason we have ioremap_bot to check when + * we actually run into our mappings setup in the early boot with the VM + * system. This really does become a problem for machines with good amounts + * of RAM. -- Cort */ -#define VMALLOC_OFFSET (0x4000000) /* 64M */ +#define VMALLOC_OFFSET (0x4000000) /* 64M */ #define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_END 0xf0000000 +#define VMALLOC_END ioremap_bot /* * Bits in a linux-style PTE. These match the bits in the @@ -359,47 +363,46 @@ extern inline pte_t * pte_offset(pmd_t * dir, unsigned long address) return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); } - /* * This is handled very differently on the PPC since out page tables * are all 0's and I want to be able to use these zero'd pages elsewhere * as well - it gives us quite a speedup. * - * Note that the SMP/UP versions are the same since we don't need a - * per cpu list of zero pages since we do the zero-ing with the cache + * Note that the SMP/UP versions are the same but we don't need a + * per cpu list of zero pages because we do the zero-ing with the cache * off and the access routines are lock-free but the pgt cache stuff - * _IS_ per-cpu since it isn't done with any lock-free access routines + * is per-cpu since it isn't done with any lock-free access routines * (although I think we need arch-specific routines so I can do lock-free). * * I need to generalize this so we can use it for other arch's as well. * -- Cort */ +#ifdef __SMP__ +#define quicklists cpu_data[smp_processor_id()] +#else extern struct pgtable_cache_struct { unsigned long *pgd_cache; unsigned long *pte_cache; unsigned long pgtable_cache_sz; - unsigned long *zero_cache; /* head linked list of pre-zero'd pages */ - unsigned long zero_sz; /* # currently pre-zero'd pages */ - unsigned long zeropage_hits; /* # zero'd pages request that we've done */ - unsigned long zeropage_calls; /* # zero'd pages request that've been made */ - unsigned long zerototal; /* # pages zero'd over time */ } quicklists; +#endif -#ifdef __SMP__ -/*#warning Tell Cort to do the pgt cache for SMP*/ -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) -#else /* __SMP__ */ -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) -#endif /* __SMP__ */ - -#define zero_quicklist (quicklists.zero_cache) -#define zero_cache_sz (quicklists.zero_sz) +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) + +extern unsigned long *zero_cache; /* head linked list of pre-zero'd pages */ +extern unsigned long zero_sz; /* # currently pre-zero'd pages */ +extern unsigned long zeropage_hits; /* # zero'd pages request that we've done */ +extern unsigned long zeropage_calls; /* # zero'd pages request that've been made */ +extern unsigned long zerototal; /* # pages zero'd over time */ + +#define zero_quicklist (zero_cache) +#define zero_cache_sz (zero_sz) +#define zero_cache_calls (zeropage_calls) +#define zero_cache_hits (zeropage_hits) +#define zero_cache_total (zerototal) /* return a pre-zero'd page from the list, return NULL if none available -- Cort */ extern unsigned long get_zero_page_fast(void); @@ -410,8 +413,8 @@ extern __inline__ pgd_t *get_pgd_slow(void) if ( (ret = (pgd_t *)get_zero_page_fast()) == NULL ) { - ret = (pgd_t *)__get_free_page(GFP_KERNEL); - memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); + if ( (ret = (pgd_t *)__get_free_page(GFP_KERNEL)) != NULL ) + memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); } if (ret) { init = pgd_offset(&init_mm, 0); @@ -553,7 +556,7 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry) /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our callee, so we can modify pgd caches of other CPUs as well. -jj */ for (i = 0; i < NR_CPUS; i++) - for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + for (pgd = (pgd_t *)cpu_data[i].pgd_cache; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) pgd[address >> PGDIR_SHIFT] = entry; #endif } diff --git a/include/asm-ppc/pmu.h b/include/asm-ppc/pmu.h index ee04ae2a8..f6309d6b2 100644 --- a/include/asm-ppc/pmu.h +++ b/include/asm-ppc/pmu.h @@ -9,7 +9,7 @@ /* * PMU commands */ -#define PMU_BACKLIGHT_CTRL 0x11 /* control backlight */ +#define PMU_POWER_CTRL 0x11 /* control power of some devices */ #define PMU_ADB_CMD 0x20 /* send ADB packet */ #define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */ #define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */ @@ -29,6 +29,12 @@ #define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */ #define PMU_GET_COVER 0xdc /* report cover open/closed */ +/* Bits to use with the PMU_POWER_CTRL command */ +#define PMU_POW_ON 0x80 /* OR this to power ON the device */ +#define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ +#define PMU_POW_BACKLIGHT 0x01 /* backlight power */ +#define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) ??? */ + /* Bits in PMU interrupt and interrupt mask bytes */ #define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */ #define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */ @@ -36,27 +42,47 @@ #define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */ #define PMU_INT_TICK 0x80 /* 1-second tick interrupt */ +/* Kind of PMU (model) */ +enum { + PMU_UNKNOWN, + PMU_OHARE_BASED, + PMU_HEATHROW_BASED +}; /* * Ioctl commands for the /dev/pmu device */ #include <linux/ioctl.h> +/* no param */ #define PMU_IOC_SLEEP _IO('B', 0) +/* out param: u32* backlight value: 0 to 31 */ +#define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, sizeof(__u32*)) +/* in param: u32 backlight value: 0 to 31 */ +#define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, sizeof(__u32)) +/* out param: u32* backlight value: 0 to 31 */ +#define PMU_IOC_GET_MODEL _IOR('B', 3, sizeof(__u32*)) #ifdef __KERNEL__ + void find_via_pmu(void); void via_pmu_init(void); + int pmu_request(struct adb_request *req, void (*done)(struct adb_request *), int nbytes, ...); -int pmu_send_request(struct adb_request *req); void pmu_poll(void); void pmu_enable_backlight(int on); +void pmu_set_brightness(int level); + +void pmu_enable_irled(int on); void pmu_restart(void); void pmu_shutdown(void); +int pmu_present(void); +int pmu_get_model(void); + /* * Stuff for putting the powerbook to sleep and waking it again. */ diff --git a/include/asm-ppc/posix_types.h b/include/asm-ppc/posix_types.h index 479a9e8e8..893b90f70 100644 --- a/include/asm-ppc/posix_types.h +++ b/include/asm-ppc/posix_types.h @@ -43,7 +43,8 @@ typedef struct { #else /* __GNUC__ */ -#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \ + || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0) /* With GNU C, use inline functions instead so args are evaluated only once: */ #undef __FD_SET diff --git a/include/asm-ppc/prep_nvram.h b/include/asm-ppc/prep_nvram.h new file mode 100644 index 000000000..2f0f80b5c --- /dev/null +++ b/include/asm-ppc/prep_nvram.h @@ -0,0 +1,146 @@ +/* + * PreP compliant NVRAM access + */ + +/* Corey Minyard (minyard@acm.org) - Stolen from PReP book. Per the + license I must say: + (C) Copyright (Corey Minyard), (1998). All rights reserved + */ + +/* Structure map for NVRAM on PowerPC Reference Platform */ +/* All fields are either character/byte strings which are valid either + endian or they are big-endian numbers. + + There are a number of Date and Time fields which are in RTC format, + big-endian. These are stored in UT (GMT). + + For enum's: if given in hex then they are bit significant, i.e. only + one bit is on for each enum. +*/ +#ifndef _PPC_PREP_NVRAM_H +#define _PPC_PREP_NVRAM_H + +#define NVSIZE 4096 /* size of NVRAM */ +#define OSAREASIZE 512 /* size of OSArea space */ +#define CONFSIZE 1024 /* guess at size of Configuration space */ + +typedef struct _SECURITY { + unsigned long BootErrCnt; /* Count of boot password errors */ + unsigned long ConfigErrCnt; /* Count of config password errors */ + unsigned long BootErrorDT[2]; /* Date&Time from RTC of last error in pw */ + unsigned long ConfigErrorDT[2]; /* Date&Time from RTC of last error in pw */ + unsigned long BootCorrectDT[2]; /* Date&Time from RTC of last correct pw */ + unsigned long ConfigCorrectDT[2]; /* Date&Time from RTC of last correct pw */ + unsigned long BootSetDT[2]; /* Date&Time from RTC of last set of pw */ + unsigned long ConfigSetDT[2]; /* Date&Time from RTC of last set of pw */ + unsigned char Serial[16]; /* Box serial number */ +} SECURITY; + +typedef enum _OS_ID { + Unknown = 0, + Firmware = 1, + AIX = 2, + NT = 3, + MKOS2 = 4, + MKAIX = 5, + Taligent = 6, + Solaris = 7, + MK = 12 +} OS_ID; + +typedef struct _ERROR_LOG { + unsigned char ErrorLogEntry[40]; /* To be architected */ +} ERROR_LOG; + +typedef enum _BOOT_STATUS { + BootStarted = 0x01, + BootFinished = 0x02, + RestartStarted = 0x04, + RestartFinished = 0x08, + PowerFailStarted = 0x10, + PowerFailFinished = 0x20, + ProcessorReady = 0x40, + ProcessorRunning = 0x80, + ProcessorStart = 0x0100 +} BOOT_STATUS; + +typedef struct _RESTART_BLOCK { + unsigned short Version; + unsigned short Revision; + unsigned long ResumeReserve1[2]; + volatile unsigned long BootStatus; + unsigned long CheckSum; /* Checksum of RESTART_BLOCK */ + void * RestartAddress; + void * SaveAreaAddr; + unsigned long SaveAreaLength; +} RESTART_BLOCK; + +typedef enum _OSAREA_USAGE { + Empty = 0, + Used = 1 +} OSAREA_USAGE; + +typedef enum _PM_MODE { + Suspend = 0x80, /* Part of state is in memory */ + Normal = 0x00 /* No power management in effect */ +} PMMode; + +typedef struct _HEADER { + unsigned short Size; /* NVRAM size in K(1024) */ + unsigned char Version; /* Structure map different */ + unsigned char Revision; /* Structure map the same -may + be new values in old fields + in other words old code still works */ + unsigned short Crc1; /* check sum from beginning of nvram to OSArea */ + unsigned short Crc2; /* check sum of config */ + unsigned char LastOS; /* OS_ID */ + unsigned char Endian; /* B if big endian, L if little endian */ + unsigned char OSAreaUsage; /* OSAREA_USAGE */ + unsigned char PMMode; /* Shutdown mode */ + RESTART_BLOCK RestartBlock; + SECURITY Security; + ERROR_LOG ErrorLog[2]; + + /* Global Environment information */ + void * GEAddress; + unsigned long GELength; + + /* Date&Time from RTC of last change to Global Environment */ + unsigned long GELastWriteDT[2]; + + /* Configuration information */ + void * ConfigAddress; + unsigned long ConfigLength; + + /* Date&Time from RTC of last change to Configuration */ + unsigned long ConfigLastWriteDT[2]; + unsigned long ConfigCount; /* Count of entries in Configuration */ + + /* OS dependent temp area */ + void * OSAreaAddress; + unsigned long OSAreaLength; + + /* Date&Time from RTC of last change to OSAreaArea */ + unsigned long OSAreaLastWriteDT[2]; +} HEADER; + +/* Here is the whole map of the NVRAM */ +typedef struct _NVRAM_MAP { + HEADER Header; + unsigned char GEArea[NVSIZE-CONFSIZE-OSAREASIZE-sizeof(HEADER)]; + unsigned char OSArea[OSAREASIZE]; + unsigned char ConfigArea[CONFSIZE]; +} NVRAM_MAP; + +/* Routines to manipulate the NVRAM */ +void init_prep_nvram(void); +char *prep_nvram_get_var(const char *name); +char *prep_nvram_first_var(void); +char *prep_nvram_next_var(char *name); + +/* Routines to read and write directly to the NVRAM */ +unsigned char prep_nvram_read_val(int addr); +void prep_nvram_write_val(int addr, + unsigned char val); + +#endif /* _PPC_PREP_NVRAM_H */ diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index de8f12e5b..d3cca8a28 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -60,21 +60,36 @@ #define FPSCR_FEX (1<<30) #define _MACH_prep 1 -#define _MACH_Pmac 2 /* pmac or pmac clone (non-chrp) */ -#define _MACH_chrp 4 /* chrp machine */ -#define _MACH_mbx 8 /* Motorola MBX board */ -#define _MACH_apus 16 /* amiga with phase5 powerup */ -#define _MACH_fads 32 /* Motorola FADS board */ +#define _MACH_Pmac 2 /* pmac or pmac clone (non-chrp) */ +#define _MACH_chrp 4 /* chrp machine */ +#define _MACH_mbx 8 /* Motorola MBX board */ +#define _MACH_apus 16 /* amiga with phase5 powerup */ +#define _MACH_fads 32 /* Motorola FADS board */ +#define _MACH_rpxlite 64 /* RPCG RPX-Lite 8xx board */ +#define _MACH_bseip 128 /* Bright Star Engineering ip-Engine */ +#define _MACH_yk 256 /* Motorola Yellowknife */ /* see residual.h for these */ #define _PREP_Motorola 0x01 /* motorola prep */ #define _PREP_Firm 0x02 /* firmworks prep */ #define _PREP_IBM 0x00 /* ibm prep */ #define _PREP_Bull 0x03 /* bull prep */ +#define _PREP_Radstone 0x04 /* Radstone Technology PLC prep */ + +/* + * Radstone board types + */ +#define RS_SYS_TYPE_PPC1 0 +#define RS_SYS_TYPE_PPC2 1 +#define RS_SYS_TYPE_PPC1a 2 +#define RS_SYS_TYPE_PPC2a 3 +#define RS_SYS_TYPE_PPC4 4 +#define RS_SYS_TYPE_PPC4a 5 +#define RS_SYS_TYPE_PPC2ep 6 /* these are arbitrary */ #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ -#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ +#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ #define _GLOBAL(n)\ .globl n;\ @@ -160,70 +175,23 @@ n: #define SR15 15 #ifndef __ASSEMBLY__ -/* - * If we've configured for a specific machine set things - * up so the compiler can optimize away the other parts. - * -- Cort - */ -#ifdef CONFIG_MACH_SPECIFIC -#ifdef CONFIG_PREP -#define _machine (_MACH_prep) -#define is_prep (1) -#define is_chrp (0) -#define have_of (0) -#endif /* CONFIG_PREP */ - -#ifdef CONFIG_CHRP -#define _machine (_MACH_chrp) -#define is_prep (0) -#define is_chrp (1) -#define have_of (1) -#endif /* CONFIG_CHRP */ - -#ifdef CONFIG_PMAC -#define _machine (_MACH_Pmac) -#define is_prep (0) -#define is_chrp (0) -#define have_of (1) -#endif /* CONFIG_PMAC */ - -#ifdef CONFIG_MBX -#define _machine (_MACH_mbx) -#define is_prep (0) -#define is_chrp (0) -#define have_of (0) -#endif /* CONFIG_MBX */ - -#ifdef CONFIG_FADS -#define _machine (_MACH_fads) -#define is_prep (0) -#define is_chrp (0) -#define have_of (0) -#endif /* CONFIG_FADS */ - -#ifdef CONFIG_APUS -#define _machine (_MACH_apus) -#define is_prep (0) -#define is_chrp (0) -#define have_of (0) -#endif /* CONFIG_APUS */ - -#else /* CONFIG_MACH_SPECIFIC */ - extern int _machine; -/* if we're a prep machine */ -#define is_prep (_machine == _MACH_prep) - -/* if we're a chrp machine */ -#define is_chrp (_machine == _MACH_chrp) - -/* if we have openfirmware */ -extern unsigned long have_of; -#endif /* CONFIG_MACH_SPECIFIC */ +/* Temporary hacks until we can clean things up better - Corey */ +extern int have_of; +extern int is_prep; +extern int is_chrp; +extern int is_powerplus; /* what kind of prep workstation we are */ extern int _prep_type; +/* + * This is used to identify the board type from a given PReP board + * vendor. Board revision is also made available. + */ +extern unsigned char ucSystemType; +extern unsigned char ucBoardRev; +extern unsigned char ucBoardRevMaj, ucBoardRevMin; struct task_struct; void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp); @@ -267,7 +235,6 @@ struct thread_struct { double fpr[32]; /* Complete floating point set */ unsigned long fpscr_pad; /* fpr ... fpscr must be contiguous */ unsigned long fpscr; /* Floating point status */ - unsigned long smp_fork_ret; }; #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) @@ -279,7 +246,7 @@ struct thread_struct { (struct pt_regs *)INIT_SP - 1, /* regs */ \ KERNEL_DS, /*fs*/ \ 0, /* last_syscall */ \ - {0}, 0, 0, 0 \ + {0}, 0, 0 \ } /* @@ -318,6 +285,9 @@ void ll_puts(const char *); #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) +/* In misc.c */ +void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); + /* * Return_address is a replacement for __builtin_return_address(count) * which on certain architectures cannot reasonably be implemented in GCC diff --git a/include/asm-ppc/raven.h b/include/asm-ppc/raven.h new file mode 100644 index 000000000..62f996f66 --- /dev/null +++ b/include/asm-ppc/raven.h @@ -0,0 +1,33 @@ +/* + * asm-ppc/raven.h -- Raven MPIC chip. + * + * Copyright (C) 1998 Johnnie Peters + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#ifndef _ASMPPC_RAVEN_H +#define _ASMPPC_RAVEN_H + +#define MVME2600_INT_SIO 0 +#define MVME2600_INT_FALCN_ECC_ERR 1 +#define MVME2600_INT_PCI_ETHERNET 2 +#define MVME2600_INT_PCI_SCSI 3 +#define MVME2600_INT_PCI_GRAPHICS 4 +#define MVME2600_INT_PCI_VME0 5 +#define MVME2600_INT_PCI_VME1 6 +#define MVME2600_INT_PCI_VME2 7 +#define MVME2600_INT_PCI_VME3 8 +#define MVME2600_INT_PCI_INTA 9 +#define MVME2600_INT_PCI_INTB 10 +#define MVME2600_INT_PCI_INTC 11 +#define MVME2600_INT_PCI_INTD 12 +#define MVME2600_INT_LM_SIG0 13 +#define MVME2600_INT_LM_SIG1 14 + +extern struct hw_interrupt_type raven_pic; + +extern int raven_init(void); +#endif _ASMPPC_RAVEN_H diff --git a/include/asm-ppc/semaphore-helper.h b/include/asm-ppc/semaphore-helper.h new file mode 100644 index 000000000..3033272d9 --- /dev/null +++ b/include/asm-ppc/semaphore-helper.h @@ -0,0 +1,107 @@ +#ifndef _PPC_SEMAPHORE_HELPER_H +#define _PPC_SEMAPHORE_HELPER_H + +/* + * SMP- and interrupt-safe semaphores.. + * + * (C) Copyright 1996 Linus Torvalds + * Adapted for PowerPC by Gary Thomas and Paul Mackerras + */ + +#include <asm/atomic.h> + +/* + * These two (wake_one_more and waking_non_zero) _must_ execute + * atomically wrt each other. + * + * This is trivially done with load with reservation and + * store conditional on the ppc. + */ + +static inline void wake_one_more(struct semaphore * sem) +{ + atomic_inc(&sem->waking); +} + +static inline int waking_non_zero(struct semaphore *sem) +{ + int ret, tmp; + + /* Atomic decrement sem->waking iff it is > 0 */ + __asm__ __volatile__( + "1: lwarx %1,0,%2\n" /* tmp = sem->waking */ + " cmpwi 0,%1,0\n" /* test tmp */ + " addic %1,%1,-1\n" /* --tmp */ + " ble- 2f\n" /* exit if tmp was <= 0 */ + " stwcx. %1,0,%2\n" /* update sem->waking */ + " bne- 1b\n" /* try again if update failed*/ + " li %0,1\n" /* ret = 1 */ + "2:" + : "=r" (ret), "=&r" (tmp) + : "r" (&sem->waking), "0" (0) + : "cr0", "memory"); + + return ret; +} +/* + * waking_non_zero_interruptible: + * 1 got the lock + * 0 go to sleep + * -EINTR interrupted + */ +static inline int waking_non_zero_interruptible(struct semaphore *sem, + struct task_struct *tsk) +{ + int ret, tmp; + + /* Atomic decrement sem->waking iff it is > 0 */ + __asm__ __volatile__( + "1: lwarx %1,0,%2\n" /* tmp = sem->waking */ + " cmpwi 0,%1,0\n" /* test tmp */ + " addic %1,%1,-1\n" /* --tmp */ + " ble- 2f\n" /* exit if tmp was <= 0 */ + " stwcx. %1,0,%2\n" /* update sem->waking */ + " bne- 1b\n" /* try again if update failed*/ + " li %0,1\n" /* ret = 1 */ + "2:" + : "=r" (ret), "=&r" (tmp) + : "r" (&sem->waking), "0" (0) + : "cr0", "memory"); + + if (ret == 0 && signal_pending(tsk)) { + atomic_inc(&sem->count); + ret = -EINTR; + } + return ret; +} + +/* + * waking_non_zero_trylock: + * 1 failed to lock + * 0 got the lock + */ +static inline int waking_non_zero_trylock(struct semaphore *sem) +{ + int ret, tmp; + + /* Atomic decrement sem->waking iff it is > 0 */ + __asm__ __volatile__( + "1: lwarx %1,0,%2\n" /* tmp = sem->waking */ + " cmpwi 0,%1,0\n" /* test tmp */ + " addic %1,%1,-1\n" /* --tmp */ + " ble- 2f\n" /* exit if tmp was <= 0 */ + " stwcx. %1,0,%2\n" /* update sem->waking */ + " bne- 1b\n" /* try again if update failed*/ + " li %0,0\n" /* ret = 0 */ + "2:" + : "=r" (ret), "=&r" (tmp) + : "r" (&sem->waking), "0" (1) + : "cr0", "memory"); + + if (ret) + atomic_inc(&sem->count); + + return ret; +} + +#endif /* _PPC_SEMAPHORE_HELPER_H */ diff --git a/include/asm-ppc/semaphore.h b/include/asm-ppc/semaphore.h index a78c203d2..ab21c33a6 100644 --- a/include/asm-ppc/semaphore.h +++ b/include/asm-ppc/semaphore.h @@ -13,66 +13,54 @@ struct semaphore { atomic_t count; atomic_t waking; - struct wait_queue * wait; + struct wait_queue *wait; }; -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL }) +#define sema_init(sem, val) atomic_set(&((sem)->count), (val)) + +#define MUTEX ((struct semaphore) \ + { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL }) +#define MUTEX_LOCKED ((struct semaphore) \ + { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL }) extern void __down(struct semaphore * sem); extern int __down_interruptible(struct semaphore * sem); +extern int __down_trylock(struct semaphore * sem); extern void __up(struct semaphore * sem); -#define sema_init(sem, val) atomic_set(&((sem)->count), (val)) - -/* - * These two _must_ execute atomically wrt each other. - * - * This is trivially done with load_locked/store_cond, - * i.e. load with reservation and store conditional on the ppc. - */ - -static inline void wake_one_more(struct semaphore * sem) +extern inline void down(struct semaphore * sem) { - atomic_inc(&sem->waking); + if (atomic_dec_return(&sem->count) >= 0) + wmb(); + else + __down(sem); } -static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) +extern inline int down_interruptible(struct semaphore * sem) { - int ret, tmp; - - __asm__ __volatile__( - "1: lwarx %1,0,%2\n" - " cmpwi 0,%1,0\n" - " addic %1,%1,-1\n" - " ble- 2f\n" - " stwcx. %1,0,%2\n" - " bne- 1b\n" - " li %0,1\n" - "2:" - : "=r" (ret), "=&r" (tmp) - : "r" (&sem->waking), "0" (0) - : "cr0", "memory"); + int ret = 0; + if (atomic_dec_return(&sem->count) >= 0) + wmb(); + else + ret = __down_interruptible(sem); return ret; } -extern inline void down(struct semaphore * sem) -{ - if (atomic_dec_return(&sem->count) < 0) - __down(sem); -} - -extern inline int down_interruptible(struct semaphore * sem) +extern inline int down_trylock(struct semaphore * sem) { int ret = 0; - if (atomic_dec_return(&sem->count) < 0) - ret = __down_interruptible(sem); + + if (atomic_dec_return(&sem->count) >= 0) + wmb(); + else + ret = __down_trylock(sem); return ret; } extern inline void up(struct semaphore * sem) { + mb(); if (atomic_inc_return(&sem->count) <= 0) __up(sem); } diff --git a/include/asm-ppc/siginfo.h b/include/asm-ppc/siginfo.h index c3a46ceff..f838fcc82 100644 --- a/include/asm-ppc/siginfo.h +++ b/include/asm-ppc/siginfo.h @@ -138,7 +138,7 @@ typedef struct siginfo { */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ -#define NSIGTRAP +#define NSIGTRAP 2 /* * SIGCHLD si_codes diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index 4fb817a8e..9186b39e5 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h @@ -6,21 +6,31 @@ #ifndef _PPC_SMP_H #define _PPC_SMP_H -#include <linux/kernel.h> /* for panic */ -#include <linux/tasks.h> /* for NR_CPUS */ +#include <linux/kernel.h> +#include <linux/tasks.h> #ifdef __SMP__ #ifndef __ASSEMBLY__ +struct cpuinfo_PPC { + unsigned long loops_per_sec; + unsigned long pvr; + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +}; +extern struct cpuinfo_PPC cpu_data[NR_CPUS]; + extern int first_cpu_booted; extern unsigned long smp_proc_in_lock[NR_CPUS]; extern void smp_message_pass(int target, int msg, unsigned long data, int wait); extern void smp_store_cpu_info(int id); +extern void smp_message_recv(void); #define NO_PROC_ID 0xFF /* No processor magic marker */ -#define PROC_CHANGE_PENALTY 2000 +#define PROC_CHANGE_PENALTY 20 /* 1 to 1 mapping on PPC -- Cort */ #define cpu_logical_map(cpu) (cpu) @@ -30,17 +40,6 @@ extern volatile unsigned long cpu_callin_map[NR_CPUS]; #define hard_smp_processor_id() (0) #define smp_processor_id() (current->processor) -/* per processor PPC parameters we need. */ -struct cpuinfo_PPC { - unsigned long loops_per_sec; - unsigned long pvr; - unsigned long *pgd_quick; - unsigned long *pte_quick; - unsigned long pgtable_cache_sz; -}; - -extern struct cpuinfo_PPC cpu_data[NR_CPUS]; - struct klock_info_struct { unsigned long kernel_flag; unsigned char akp; diff --git a/include/asm-ppc/softirq.h b/include/asm-ppc/softirq.h index e2064f07d..373de2356 100644 --- a/include/asm-ppc/softirq.h +++ b/include/asm-ppc/softirq.h @@ -4,7 +4,7 @@ #include <asm/atomic.h> #include <asm/hardirq.h> -extern unsigned int local_bh_count[NR_CPUS]; +extern unsigned int ppc_local_bh_count[NR_CPUS]; #define get_active_bhs() (bh_mask & bh_active) #define clear_active_bhs(x) atomic_clear_mask((x),&bh_active) @@ -18,8 +18,9 @@ extern inline void init_bh(int nr, void (*routine)(void)) extern inline void remove_bh(int nr) { - bh_base[nr] = NULL; bh_mask &= ~(1 << nr); + wmb(); + bh_base[nr] = NULL; } extern inline void mark_bh(int nr) @@ -28,6 +29,7 @@ extern inline void mark_bh(int nr) } #ifdef __SMP__ + /* * The locking mechanism for base handlers, to prevent re-entrancy, * is entirely private to an implementation, it should not be @@ -54,7 +56,7 @@ static inline int softirq_trylock(int cpu) { if (!test_and_set_bit(0,&global_bh_count)) { if (atomic_read(&global_bh_lock) == 0) { - ++local_bh_count[cpu]; + ++ppc_local_bh_count[cpu]; return 1; } clear_bit(0,&global_bh_count); @@ -64,30 +66,30 @@ static inline int softirq_trylock(int cpu) static inline void softirq_endlock(int cpu) { - local_bh_count[cpu]--; + ppc_local_bh_count[cpu]--; clear_bit(0,&global_bh_count); } -#else /* __SMP__ */ +#else extern inline void start_bh_atomic(void) { - local_bh_count[smp_processor_id()]++; + ppc_local_bh_count[smp_processor_id()]++; barrier(); } extern inline void end_bh_atomic(void) { barrier(); - local_bh_count[smp_processor_id()]--; + ppc_local_bh_count[smp_processor_id()]--; } /* These are for the irq's testing the lock */ -#define softirq_trylock(cpu) (local_bh_count[cpu] ? 0 : (local_bh_count[cpu]=1)) -#define softirq_endlock(cpu) (local_bh_count[cpu] = 0) -#define synchronize_bh() do { } while (0) +#define softirq_trylock(cpu) (ppc_local_bh_count[cpu] ? 0 : (ppc_local_bh_count[cpu]=1)) +#define softirq_endlock(cpu) (ppc_local_bh_count[cpu] = 0) +#define synchronize_bh() barrier() -#endif /* __SMP__ */ +#endif /* SMP */ /* * These use a mask count to correctly handle @@ -106,4 +108,4 @@ extern inline void enable_bh(int nr) bh_mask |= 1 << nr; } -#endif +#endif /* __ASM_SOFTIRQ_H */ diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h index c048dbc1a..afaf5ebb3 100644 --- a/include/asm-ppc/spinlock.h +++ b/include/asm-ppc/spinlock.h @@ -102,6 +102,8 @@ extern int spin_trylock(spinlock_t *lock); #define spin_unlock_irqrestore(lock, flags) \ do { spin_unlock(lock); __restore_flags(flags); } while (0) +extern unsigned long __spin_trylock(volatile unsigned long *lock); + /* * Read-write spinlocks, allowing multiple readers * but only one writer. diff --git a/include/asm-ppc/string.h b/include/asm-ppc/string.h index 1af5e6270..e0158a215 100644 --- a/include/asm-ppc/string.h +++ b/include/asm-ppc/string.h @@ -14,5 +14,6 @@ #define __HAVE_ARCH_MEMCHR extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, int); #endif diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 5a1740847..427bb5ddd 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -9,38 +9,42 @@ * Memory barrier. * The sync instruction guarantees that all memory accesses initiated * by this processor have been performed (with respect to all other - * mechanisms that access memory). + * mechanisms that access memory). The eieio instruction is a barrier + * providing an ordering (separately) for (a) cacheable stores and (b) + * loads and stores to non-cacheable memory (e.g. I/O devices). + * + * mb() prevents loads and stores being reordered across this point. + * rmb() prevents loads being reordered across this point. + * wmb() prevents stores being reordered across this point. + * + * We can use the eieio instruction for wmb, but since it doesn't + * give any ordering guarantees about loads, we have to use the + * stronger but slower sync instruction for mb and rmb. */ #define mb() __asm__ __volatile__ ("sync" : : : "memory") #define rmb() __asm__ __volatile__ ("sync" : : : "memory") -#define wmb() __asm__ __volatile__ ("sync" : : : "memory") +#define wmb() __asm__ __volatile__ ("eieio" : : : "memory") + +extern void xmon_irq(int, void *, struct pt_regs *); +extern void xmon(struct pt_regs *excp); #define __save_flags(flags) ({\ __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory"); }) #define __save_and_cli(flags) ({__save_flags(flags);__cli();}) +/* Data cache block flush - write out the cache line containing the + specified address and then invalidate it in the cache. */ extern __inline__ void dcbf(void *line) { - asm("dcbf %0,%1\n\t" - "sync \n\t" - "isync \n\t" - :: "r" (line), "r" (0)); + asm("dcbf %0,%1; sync" : : "r" (line), "r" (0)); } -extern __inline__ void dcbi(void *line) -{ - asm("dcbi %0,%1\n\t" - "sync \n\t" - "isync \n\t" - :: "r" (line), "r" (0)); -} - extern __inline__ void __restore_flags(unsigned long flags) { - extern atomic_t n_lost_interrupts; + extern atomic_t ppc_n_lost_interrupts; extern void do_lost_interrupts(unsigned long); - if ((flags & MSR_EE) && atomic_read(&n_lost_interrupts) != 0) { + if ((flags & MSR_EE) && atomic_read(&ppc_n_lost_interrupts) != 0) { do_lost_interrupts(flags); } else { __asm__ __volatile__ ("sync; mtmsr %0; isync" @@ -54,6 +58,7 @@ extern void __cli(void); extern int _disable_interrupts(void); extern void _enable_interrupts(int); +extern void instruction_dump(unsigned long *); extern void print_backtrace(unsigned long *); extern void show_regs(struct pt_regs * regs); extern void flush_instruction_cache(void); @@ -66,8 +71,8 @@ extern void via_cuda_init(void); extern void pmac_nvram_init(void); extern void read_rtc_time(void); extern void pmac_find_display(void); -extern void giveup_fpu(void); -extern void smp_giveup_fpu(struct task_struct *); +extern void giveup_fpu(struct task_struct *); +extern void enable_kernel_fp(void); extern void cvt_fd(float *from, double *to, unsigned long *fpscr); extern void cvt_df(double *from, float *to, unsigned long *fpscr); @@ -75,11 +80,14 @@ struct device_node; extern void note_scsi_host(struct device_node *, void *); struct task_struct; -extern void switch_to(struct task_struct *prev, struct task_struct *next); +#define switch_to(prev,next,last) _switch_to((prev),(next),&(last)) +extern void _switch_to(struct task_struct *, struct task_struct *, + struct task_struct **); struct thread_struct; -extern void _switch(struct thread_struct *prev, struct thread_struct *next, - unsigned long context); +extern struct task_struct *_switch(struct thread_struct *prev, + struct thread_struct *next, + unsigned long context); struct pt_regs; extern void dump_regs(struct pt_regs *); @@ -107,8 +115,8 @@ extern void __global_restore_flags(unsigned long); #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) -extern void *xchg_u64(void *ptr, unsigned long val); -extern void *xchg_u32(void *m, unsigned long val); +extern unsigned long xchg_u64(void *ptr, unsigned long val); +extern unsigned long xchg_u32(void *ptr, unsigned long val); /* * This function doesn't exist, so you'll get a linker error @@ -126,10 +134,10 @@ extern void __xchg_called_with_bad_pointer(void); static inline unsigned long __xchg(unsigned long x, void * ptr, int size) { switch (size) { - case 4: - return (unsigned long )xchg_u32(ptr, x); - case 8: - return (unsigned long )xchg_u64(ptr, x); + case 4: + return (unsigned long )xchg_u32(ptr, x); + case 8: + return (unsigned long )xchg_u64(ptr, x); } __xchg_called_with_bad_pointer(); return x; diff --git a/include/asm-ppc/termbits.h b/include/asm-ppc/termbits.h index 0d387ca10..11b4c513a 100644 --- a/include/asm-ppc/termbits.h +++ b/include/asm-ppc/termbits.h @@ -121,7 +121,7 @@ struct termios { #define B38400 0000017 #define EXTA B19200 #define EXTB B38400 -#define CBAUDEX 0000020 +#define CBAUDEX 0000000 #define B57600 00020 #define B115200 00021 #define B230400 00022 diff --git a/include/asm-ppc/termios.h b/include/asm-ppc/termios.h index 13b3591b8..a234aff15 100644 --- a/include/asm-ppc/termios.h +++ b/include/asm-ppc/termios.h @@ -184,6 +184,7 @@ struct termio { #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ #ifdef __KERNEL__ diff --git a/include/asm-ppc/types.h b/include/asm-ppc/types.h index 6f95c17e6..86fa349d3 100644 --- a/include/asm-ppc/types.h +++ b/include/asm-ppc/types.h @@ -6,6 +6,8 @@ * header files exported to user space */ +typedef unsigned short umode_t; + typedef __signed__ char __s8; typedef unsigned char __u8; @@ -25,8 +27,6 @@ typedef unsigned long long __u64; */ #ifdef __KERNEL__ -typedef unsigned short umode_t; - typedef signed char s8; typedef unsigned char u8; diff --git a/include/asm-ppc/uaccess.h b/include/asm-ppc/uaccess.h index b22b81511..59956966a 100644 --- a/include/asm-ppc/uaccess.h +++ b/include/asm-ppc/uaccess.h @@ -27,7 +27,7 @@ #define segment_eq(a,b) ((a).seg == (b).seg) #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) -#define __user_ok(addr,size) (((size) <= 0x80000000)&&((addr) <= 0x80000000-(size))) +#define __user_ok(addr,size) (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) #define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) @@ -224,6 +224,10 @@ copy_to_user(void *to, const void *from, unsigned long n) return n; } +#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) + +#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; }) + #define __copy_from_user(to, from, size) \ __copy_tofrom_user((to), (from), (size)) #define __copy_to_user(to, from, size) \ diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h index 5e8c3910e..bc96d7fef 100644 --- a/include/asm-ppc/unistd.h +++ b/include/asm-ppc/unistd.h @@ -193,6 +193,7 @@ #define __NR_sendfile 186 #define __NR_getpmsg 187 /* some people actually want streams */ #define __NR_putpmsg 188 /* some people actually want streams */ +#define __NR_vfork 189 #define __NR(n) #n diff --git a/include/asm-ppc/vga.h b/include/asm-ppc/vga.h index 1ab739772..85c9ec8a9 100644 --- a/include/asm-ppc/vga.h +++ b/include/asm-ppc/vga.h @@ -8,24 +8,46 @@ #define _LINUX_ASM_VGA_H_ #include <asm/io.h> +#include <asm/processor.h> + +#include <linux/config.h> +#include <linux/console.h> #define VT_BUF_HAVE_RW extern inline void scr_writew(u16 val, u16 *addr) { - st_le16(addr, val); + /* If using vgacon (not fbcon) byteswap the writes. + * If non-vgacon assume fbcon and don't byteswap + * just like include/linux/vt_buffer.h. + * XXX: this is a performance loss so get rid of it + * as soon as fbcon works on prep. + * -- Cort + */ +#ifdef CONFIG_FB + if ( conswitchp != &vga_con ) + (*(addr) = (val)); + else +#endif /* CONFIG_FB */ + st_le16(addr, val); } -extern inline u16 scr_readw(u16 *addr) +extern inline u16 scr_readw(const u16 *addr) { - return ld_le16(addr); +#ifdef CONFIG_FB + if ( conswitchp != &vga_con ) + return (*(addr)); + else +#endif /* CONFIG_FB */ + return ld_le16((unsigned short *)addr); } #define VT_BUF_HAVE_MEMCPYF #define scr_memcpyw_from memcpy #define scr_memcpyw_to memcpy -#define VGA_MAP_MEM(x) (x + _ISA_MEM_BASE) +extern unsigned long vgacon_remap_base; +#define VGA_MAP_MEM(x) (x + vgacon_remap_base) #define vga_readb(x) (*(x)) #define vga_writeb(x,y) (*(y) = (x)) diff --git a/include/asm-sparc/asm_offsets.h b/include/asm-sparc/asm_offsets.h index 655987dd5..c45a7b4a7 100644 --- a/include/asm-sparc/asm_offsets.h +++ b/include/asm-sparc/asm_offsets.h @@ -2,7 +2,9 @@ #ifndef __ASM_OFFSETS_H__ #define __ASM_OFFSETS_H__ -#ifndef __SMP__ +#include <linux/config.h> + +#ifndef CONFIG_SMP #define AOFF_task_state 0x00000000 #define ASIZ_task_state 0x00000004 @@ -20,217 +22,219 @@ #define ASIZ_task_counter 0x00000004 #define AOFF_task_priority 0x0000001c #define ASIZ_task_priority 0x00000004 -#define AOFF_task_has_cpu 0x00000020 +#define AOFF_task_avg_slice 0x00000020 +#define ASIZ_task_avg_slice 0x00000004 +#define AOFF_task_has_cpu 0x00000024 #define ASIZ_task_has_cpu 0x00000004 -#define AOFF_task_processor 0x00000024 +#define AOFF_task_processor 0x00000028 #define ASIZ_task_processor 0x00000004 -#define AOFF_task_last_processor 0x00000028 +#define AOFF_task_last_processor 0x0000002c #define ASIZ_task_last_processor 0x00000004 -#define AOFF_task_lock_depth 0x0000002c +#define AOFF_task_lock_depth 0x00000030 #define ASIZ_task_lock_depth 0x00000004 -#define AOFF_task_next_task 0x00000030 +#define AOFF_task_next_task 0x00000034 #define ASIZ_task_next_task 0x00000004 -#define AOFF_task_prev_task 0x00000034 +#define AOFF_task_prev_task 0x00000038 #define ASIZ_task_prev_task 0x00000004 -#define AOFF_task_next_run 0x00000038 +#define AOFF_task_next_run 0x0000003c #define ASIZ_task_next_run 0x00000004 -#define AOFF_task_prev_run 0x0000003c +#define AOFF_task_prev_run 0x00000040 #define ASIZ_task_prev_run 0x00000004 -#define AOFF_task_binfmt 0x00000040 +#define AOFF_task_binfmt 0x00000044 #define ASIZ_task_binfmt 0x00000004 -#define AOFF_task_exit_code 0x00000044 +#define AOFF_task_exit_code 0x00000048 #define ASIZ_task_exit_code 0x00000004 -#define AOFF_task_exit_signal 0x00000048 +#define AOFF_task_exit_signal 0x0000004c #define ASIZ_task_exit_signal 0x00000004 -#define AOFF_task_pdeath_signal 0x0000004c +#define AOFF_task_pdeath_signal 0x00000050 #define ASIZ_task_pdeath_signal 0x00000004 -#define AOFF_task_personality 0x00000050 +#define AOFF_task_personality 0x00000054 #define ASIZ_task_personality 0x00000004 -#define AOFF_task_pid 0x00000058 +#define AOFF_task_pid 0x0000005c #define ASIZ_task_pid 0x00000004 -#define AOFF_task_pgrp 0x0000005c +#define AOFF_task_pgrp 0x00000060 #define ASIZ_task_pgrp 0x00000004 -#define AOFF_task_tty_old_pgrp 0x00000060 +#define AOFF_task_tty_old_pgrp 0x00000064 #define ASIZ_task_tty_old_pgrp 0x00000004 -#define AOFF_task_session 0x00000064 +#define AOFF_task_session 0x00000068 #define ASIZ_task_session 0x00000004 -#define AOFF_task_leader 0x00000068 +#define AOFF_task_leader 0x0000006c #define ASIZ_task_leader 0x00000004 -#define AOFF_task_p_opptr 0x0000006c +#define AOFF_task_p_opptr 0x00000070 #define ASIZ_task_p_opptr 0x00000004 -#define AOFF_task_p_pptr 0x00000070 +#define AOFF_task_p_pptr 0x00000074 #define ASIZ_task_p_pptr 0x00000004 -#define AOFF_task_p_cptr 0x00000074 +#define AOFF_task_p_cptr 0x00000078 #define ASIZ_task_p_cptr 0x00000004 -#define AOFF_task_p_ysptr 0x00000078 +#define AOFF_task_p_ysptr 0x0000007c #define ASIZ_task_p_ysptr 0x00000004 -#define AOFF_task_p_osptr 0x0000007c +#define AOFF_task_p_osptr 0x00000080 #define ASIZ_task_p_osptr 0x00000004 -#define AOFF_task_pidhash_next 0x00000080 +#define AOFF_task_pidhash_next 0x00000084 #define ASIZ_task_pidhash_next 0x00000004 -#define AOFF_task_pidhash_pprev 0x00000084 +#define AOFF_task_pidhash_pprev 0x00000088 #define ASIZ_task_pidhash_pprev 0x00000004 -#define AOFF_task_tarray_ptr 0x00000088 +#define AOFF_task_tarray_ptr 0x0000008c #define ASIZ_task_tarray_ptr 0x00000004 -#define AOFF_task_wait_chldexit 0x0000008c +#define AOFF_task_wait_chldexit 0x00000090 #define ASIZ_task_wait_chldexit 0x00000004 -#define AOFF_task_policy 0x00000090 +#define AOFF_task_vfork_sem 0x00000094 +#define ASIZ_task_vfork_sem 0x00000004 +#define AOFF_task_policy 0x00000098 #define ASIZ_task_policy 0x00000004 -#define AOFF_task_rt_priority 0x00000094 +#define AOFF_task_rt_priority 0x0000009c #define ASIZ_task_rt_priority 0x00000004 -#define AOFF_task_it_real_value 0x00000098 +#define AOFF_task_it_real_value 0x000000a0 #define ASIZ_task_it_real_value 0x00000004 -#define AOFF_task_it_prof_value 0x0000009c +#define AOFF_task_it_prof_value 0x000000a4 #define ASIZ_task_it_prof_value 0x00000004 -#define AOFF_task_it_virt_value 0x000000a0 +#define AOFF_task_it_virt_value 0x000000a8 #define ASIZ_task_it_virt_value 0x00000004 -#define AOFF_task_it_real_incr 0x000000a4 +#define AOFF_task_it_real_incr 0x000000ac #define ASIZ_task_it_real_incr 0x00000004 -#define AOFF_task_it_prof_incr 0x000000a8 +#define AOFF_task_it_prof_incr 0x000000b0 #define ASIZ_task_it_prof_incr 0x00000004 -#define AOFF_task_it_virt_incr 0x000000ac +#define AOFF_task_it_virt_incr 0x000000b4 #define ASIZ_task_it_virt_incr 0x00000004 -#define AOFF_task_real_timer 0x000000b0 +#define AOFF_task_real_timer 0x000000b8 #define ASIZ_task_real_timer 0x00000014 -#define AOFF_task_times 0x000000c4 +#define AOFF_task_times 0x000000cc #define ASIZ_task_times 0x00000010 -#define AOFF_task_start_time 0x000000d4 +#define AOFF_task_start_time 0x000000dc #define ASIZ_task_start_time 0x00000004 -#define AOFF_task_per_cpu_utime 0x000000d8 +#define AOFF_task_per_cpu_utime 0x000000e0 #define ASIZ_task_per_cpu_utime 0x00000004 -#define AOFF_task_min_flt 0x000000e0 +#define AOFF_task_min_flt 0x000000e8 #define ASIZ_task_min_flt 0x00000004 -#define AOFF_task_maj_flt 0x000000e4 +#define AOFF_task_maj_flt 0x000000ec #define ASIZ_task_maj_flt 0x00000004 -#define AOFF_task_nswap 0x000000e8 +#define AOFF_task_nswap 0x000000f0 #define ASIZ_task_nswap 0x00000004 -#define AOFF_task_cmin_flt 0x000000ec +#define AOFF_task_cmin_flt 0x000000f4 #define ASIZ_task_cmin_flt 0x00000004 -#define AOFF_task_cmaj_flt 0x000000f0 +#define AOFF_task_cmaj_flt 0x000000f8 #define ASIZ_task_cmaj_flt 0x00000004 -#define AOFF_task_cnswap 0x000000f4 +#define AOFF_task_cnswap 0x000000fc #define ASIZ_task_cnswap 0x00000004 -#define AOFF_task_swap_address 0x000000fc -#define ASIZ_task_swap_address 0x00000004 -#define AOFF_task_old_maj_flt 0x00000100 -#define ASIZ_task_old_maj_flt 0x00000004 -#define AOFF_task_dec_flt 0x00000104 -#define ASIZ_task_dec_flt 0x00000004 -#define AOFF_task_swap_cnt 0x00000108 -#define ASIZ_task_swap_cnt 0x00000004 -#define AOFF_task_uid 0x0000010c +#define AOFF_task_uid 0x00000102 #define ASIZ_task_uid 0x00000002 -#define AOFF_task_euid 0x0000010e +#define AOFF_task_euid 0x00000104 #define ASIZ_task_euid 0x00000002 -#define AOFF_task_suid 0x00000110 +#define AOFF_task_suid 0x00000106 #define ASIZ_task_suid 0x00000002 -#define AOFF_task_fsuid 0x00000112 +#define AOFF_task_fsuid 0x00000108 #define ASIZ_task_fsuid 0x00000002 -#define AOFF_task_gid 0x00000114 +#define AOFF_task_gid 0x0000010a #define ASIZ_task_gid 0x00000002 -#define AOFF_task_egid 0x00000116 +#define AOFF_task_egid 0x0000010c #define ASIZ_task_egid 0x00000002 -#define AOFF_task_sgid 0x00000118 +#define AOFF_task_sgid 0x0000010e #define ASIZ_task_sgid 0x00000002 -#define AOFF_task_fsgid 0x0000011a +#define AOFF_task_fsgid 0x00000110 #define ASIZ_task_fsgid 0x00000002 -#define AOFF_task_ngroups 0x0000011c +#define AOFF_task_ngroups 0x00000114 #define ASIZ_task_ngroups 0x00000004 -#define AOFF_task_groups 0x00000120 +#define AOFF_task_groups 0x00000118 #define ASIZ_task_groups 0x00000040 -#define AOFF_task_cap_effective 0x00000160 +#define AOFF_task_cap_effective 0x00000158 #define ASIZ_task_cap_effective 0x00000004 -#define AOFF_task_cap_inheritable 0x00000164 +#define AOFF_task_cap_inheritable 0x0000015c #define ASIZ_task_cap_inheritable 0x00000004 -#define AOFF_task_cap_permitted 0x00000168 +#define AOFF_task_cap_permitted 0x00000160 #define ASIZ_task_cap_permitted 0x00000004 -#define AOFF_task_user 0x0000016c +#define AOFF_task_user 0x00000164 #define ASIZ_task_user 0x00000004 -#define AOFF_task_rlim 0x00000170 +#define AOFF_task_rlim 0x00000168 #define ASIZ_task_rlim 0x00000050 -#define AOFF_task_used_math 0x000001c0 +#define AOFF_task_used_math 0x000001b8 #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_comm 0x000001c2 +#define AOFF_task_comm 0x000001ba #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x000001d4 +#define AOFF_task_link_count 0x000001cc #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x000001d8 +#define AOFF_task_tty 0x000001d0 #define ASIZ_task_tty 0x00000004 -#define AOFF_task_semundo 0x000001dc +#define AOFF_task_semundo 0x000001d4 #define ASIZ_task_semundo 0x00000004 -#define AOFF_task_semsleeping 0x000001e0 +#define AOFF_task_semsleeping 0x000001d8 #define ASIZ_task_semsleeping 0x00000004 -#define AOFF_task_tss 0x000001e8 +#define AOFF_task_tss 0x000001e0 #define ASIZ_task_tss 0x00000388 -#define AOFF_task_fs 0x00000570 +#define AOFF_task_fs 0x00000568 #define ASIZ_task_fs 0x00000004 -#define AOFF_task_files 0x00000574 +#define AOFF_task_files 0x0000056c #define ASIZ_task_files 0x00000004 -#define AOFF_task_mm 0x00000578 +#define AOFF_task_mm 0x00000570 #define ASIZ_task_mm 0x00000004 -#define AOFF_task_sigmask_lock 0x0000057c +#define AOFF_task_sigmask_lock 0x00000574 #define ASIZ_task_sigmask_lock 0x00000001 -#define AOFF_task_sig 0x00000580 +#define AOFF_task_sig 0x00000578 #define ASIZ_task_sig 0x00000004 -#define AOFF_task_signal 0x00000584 +#define AOFF_task_signal 0x0000057c #define ASIZ_task_signal 0x00000008 -#define AOFF_task_blocked 0x0000058c +#define AOFF_task_blocked 0x00000584 #define ASIZ_task_blocked 0x00000008 -#define AOFF_task_sigqueue 0x00000594 +#define AOFF_task_sigqueue 0x0000058c #define ASIZ_task_sigqueue 0x00000004 -#define AOFF_task_sigqueue_tail 0x00000598 +#define AOFF_task_sigqueue_tail 0x00000590 #define ASIZ_task_sigqueue_tail 0x00000004 -#define AOFF_task_sas_ss_sp 0x0000059c +#define AOFF_task_sas_ss_sp 0x00000594 #define ASIZ_task_sas_ss_sp 0x00000004 -#define AOFF_task_sas_ss_size 0x000005a0 +#define AOFF_task_sas_ss_size 0x00000598 #define ASIZ_task_sas_ss_size 0x00000004 #define AOFF_mm_mmap 0x00000000 #define ASIZ_mm_mmap 0x00000004 -#define AOFF_mm_mmap_cache 0x00000004 +#define AOFF_mm_mmap_avl 0x00000004 +#define ASIZ_mm_mmap_avl 0x00000004 +#define AOFF_mm_mmap_cache 0x00000008 #define ASIZ_mm_mmap_cache 0x00000004 -#define AOFF_mm_pgd 0x00000008 +#define AOFF_mm_pgd 0x0000000c #define ASIZ_mm_pgd 0x00000004 -#define AOFF_mm_count 0x0000000c +#define AOFF_mm_count 0x00000010 #define ASIZ_mm_count 0x00000004 -#define AOFF_mm_map_count 0x00000010 +#define AOFF_mm_map_count 0x00000014 #define ASIZ_mm_map_count 0x00000004 -#define AOFF_mm_mmap_sem 0x00000014 +#define AOFF_mm_mmap_sem 0x00000018 #define ASIZ_mm_mmap_sem 0x0000000c -#define AOFF_mm_context 0x00000020 +#define AOFF_mm_context 0x00000024 #define ASIZ_mm_context 0x00000004 -#define AOFF_mm_start_code 0x00000024 +#define AOFF_mm_start_code 0x00000028 #define ASIZ_mm_start_code 0x00000004 -#define AOFF_mm_end_code 0x00000028 +#define AOFF_mm_end_code 0x0000002c #define ASIZ_mm_end_code 0x00000004 -#define AOFF_mm_start_data 0x0000002c +#define AOFF_mm_start_data 0x00000030 #define ASIZ_mm_start_data 0x00000004 -#define AOFF_mm_end_data 0x00000030 +#define AOFF_mm_end_data 0x00000034 #define ASIZ_mm_end_data 0x00000004 -#define AOFF_mm_start_brk 0x00000034 +#define AOFF_mm_start_brk 0x00000038 #define ASIZ_mm_start_brk 0x00000004 -#define AOFF_mm_brk 0x00000038 +#define AOFF_mm_brk 0x0000003c #define ASIZ_mm_brk 0x00000004 -#define AOFF_mm_start_stack 0x0000003c +#define AOFF_mm_start_stack 0x00000040 #define ASIZ_mm_start_stack 0x00000004 -#define AOFF_mm_arg_start 0x00000040 +#define AOFF_mm_arg_start 0x00000044 #define ASIZ_mm_arg_start 0x00000004 -#define AOFF_mm_arg_end 0x00000044 +#define AOFF_mm_arg_end 0x00000048 #define ASIZ_mm_arg_end 0x00000004 -#define AOFF_mm_env_start 0x00000048 +#define AOFF_mm_env_start 0x0000004c #define ASIZ_mm_env_start 0x00000004 -#define AOFF_mm_env_end 0x0000004c +#define AOFF_mm_env_end 0x00000050 #define ASIZ_mm_env_end 0x00000004 -#define AOFF_mm_rss 0x00000050 +#define AOFF_mm_rss 0x00000054 #define ASIZ_mm_rss 0x00000004 -#define AOFF_mm_total_vm 0x00000054 +#define AOFF_mm_total_vm 0x00000058 #define ASIZ_mm_total_vm 0x00000004 -#define AOFF_mm_locked_vm 0x00000058 +#define AOFF_mm_locked_vm 0x0000005c #define ASIZ_mm_locked_vm 0x00000004 -#define AOFF_mm_def_flags 0x0000005c +#define AOFF_mm_def_flags 0x00000060 #define ASIZ_mm_def_flags 0x00000004 -#define AOFF_mm_cpu_vm_mask 0x00000060 +#define AOFF_mm_cpu_vm_mask 0x00000064 #define ASIZ_mm_cpu_vm_mask 0x00000004 -#define AOFF_mm_segments 0x00000064 +#define AOFF_mm_swap_cnt 0x00000068 +#define ASIZ_mm_swap_cnt 0x00000004 +#define AOFF_mm_swap_address 0x0000006c +#define ASIZ_mm_swap_address 0x00000004 +#define AOFF_mm_segments 0x00000070 #define ASIZ_mm_segments 0x00000004 #define AOFF_thread_uwinmask 0x00000000 #define ASIZ_thread_uwinmask 0x00000004 @@ -275,7 +279,7 @@ #define AOFF_thread_new_signal 0x00000380 #define ASIZ_thread_new_signal 0x00000004 -#else /* __SMP__ */ +#else /* CONFIG_SMP */ #define AOFF_task_state 0x00000000 #define ASIZ_task_state 0x00000004 @@ -293,217 +297,219 @@ #define ASIZ_task_counter 0x00000004 #define AOFF_task_priority 0x0000001c #define ASIZ_task_priority 0x00000004 -#define AOFF_task_has_cpu 0x00000020 +#define AOFF_task_avg_slice 0x00000020 +#define ASIZ_task_avg_slice 0x00000004 +#define AOFF_task_has_cpu 0x00000024 #define ASIZ_task_has_cpu 0x00000004 -#define AOFF_task_processor 0x00000024 +#define AOFF_task_processor 0x00000028 #define ASIZ_task_processor 0x00000004 -#define AOFF_task_last_processor 0x00000028 +#define AOFF_task_last_processor 0x0000002c #define ASIZ_task_last_processor 0x00000004 -#define AOFF_task_lock_depth 0x0000002c +#define AOFF_task_lock_depth 0x00000030 #define ASIZ_task_lock_depth 0x00000004 -#define AOFF_task_next_task 0x00000030 +#define AOFF_task_next_task 0x00000034 #define ASIZ_task_next_task 0x00000004 -#define AOFF_task_prev_task 0x00000034 +#define AOFF_task_prev_task 0x00000038 #define ASIZ_task_prev_task 0x00000004 -#define AOFF_task_next_run 0x00000038 +#define AOFF_task_next_run 0x0000003c #define ASIZ_task_next_run 0x00000004 -#define AOFF_task_prev_run 0x0000003c +#define AOFF_task_prev_run 0x00000040 #define ASIZ_task_prev_run 0x00000004 -#define AOFF_task_binfmt 0x00000040 +#define AOFF_task_binfmt 0x00000044 #define ASIZ_task_binfmt 0x00000004 -#define AOFF_task_exit_code 0x00000044 +#define AOFF_task_exit_code 0x00000048 #define ASIZ_task_exit_code 0x00000004 -#define AOFF_task_exit_signal 0x00000048 +#define AOFF_task_exit_signal 0x0000004c #define ASIZ_task_exit_signal 0x00000004 -#define AOFF_task_pdeath_signal 0x0000004c +#define AOFF_task_pdeath_signal 0x00000050 #define ASIZ_task_pdeath_signal 0x00000004 -#define AOFF_task_personality 0x00000050 +#define AOFF_task_personality 0x00000054 #define ASIZ_task_personality 0x00000004 -#define AOFF_task_pid 0x00000058 +#define AOFF_task_pid 0x0000005c #define ASIZ_task_pid 0x00000004 -#define AOFF_task_pgrp 0x0000005c +#define AOFF_task_pgrp 0x00000060 #define ASIZ_task_pgrp 0x00000004 -#define AOFF_task_tty_old_pgrp 0x00000060 +#define AOFF_task_tty_old_pgrp 0x00000064 #define ASIZ_task_tty_old_pgrp 0x00000004 -#define AOFF_task_session 0x00000064 +#define AOFF_task_session 0x00000068 #define ASIZ_task_session 0x00000004 -#define AOFF_task_leader 0x00000068 +#define AOFF_task_leader 0x0000006c #define ASIZ_task_leader 0x00000004 -#define AOFF_task_p_opptr 0x0000006c +#define AOFF_task_p_opptr 0x00000070 #define ASIZ_task_p_opptr 0x00000004 -#define AOFF_task_p_pptr 0x00000070 +#define AOFF_task_p_pptr 0x00000074 #define ASIZ_task_p_pptr 0x00000004 -#define AOFF_task_p_cptr 0x00000074 +#define AOFF_task_p_cptr 0x00000078 #define ASIZ_task_p_cptr 0x00000004 -#define AOFF_task_p_ysptr 0x00000078 +#define AOFF_task_p_ysptr 0x0000007c #define ASIZ_task_p_ysptr 0x00000004 -#define AOFF_task_p_osptr 0x0000007c +#define AOFF_task_p_osptr 0x00000080 #define ASIZ_task_p_osptr 0x00000004 -#define AOFF_task_pidhash_next 0x00000080 +#define AOFF_task_pidhash_next 0x00000084 #define ASIZ_task_pidhash_next 0x00000004 -#define AOFF_task_pidhash_pprev 0x00000084 +#define AOFF_task_pidhash_pprev 0x00000088 #define ASIZ_task_pidhash_pprev 0x00000004 -#define AOFF_task_tarray_ptr 0x00000088 +#define AOFF_task_tarray_ptr 0x0000008c #define ASIZ_task_tarray_ptr 0x00000004 -#define AOFF_task_wait_chldexit 0x0000008c +#define AOFF_task_wait_chldexit 0x00000090 #define ASIZ_task_wait_chldexit 0x00000004 -#define AOFF_task_policy 0x00000090 +#define AOFF_task_vfork_sem 0x00000094 +#define ASIZ_task_vfork_sem 0x00000004 +#define AOFF_task_policy 0x00000098 #define ASIZ_task_policy 0x00000004 -#define AOFF_task_rt_priority 0x00000094 +#define AOFF_task_rt_priority 0x0000009c #define ASIZ_task_rt_priority 0x00000004 -#define AOFF_task_it_real_value 0x00000098 +#define AOFF_task_it_real_value 0x000000a0 #define ASIZ_task_it_real_value 0x00000004 -#define AOFF_task_it_prof_value 0x0000009c +#define AOFF_task_it_prof_value 0x000000a4 #define ASIZ_task_it_prof_value 0x00000004 -#define AOFF_task_it_virt_value 0x000000a0 +#define AOFF_task_it_virt_value 0x000000a8 #define ASIZ_task_it_virt_value 0x00000004 -#define AOFF_task_it_real_incr 0x000000a4 +#define AOFF_task_it_real_incr 0x000000ac #define ASIZ_task_it_real_incr 0x00000004 -#define AOFF_task_it_prof_incr 0x000000a8 +#define AOFF_task_it_prof_incr 0x000000b0 #define ASIZ_task_it_prof_incr 0x00000004 -#define AOFF_task_it_virt_incr 0x000000ac +#define AOFF_task_it_virt_incr 0x000000b4 #define ASIZ_task_it_virt_incr 0x00000004 -#define AOFF_task_real_timer 0x000000b0 +#define AOFF_task_real_timer 0x000000b8 #define ASIZ_task_real_timer 0x00000014 -#define AOFF_task_times 0x000000c4 +#define AOFF_task_times 0x000000cc #define ASIZ_task_times 0x00000010 -#define AOFF_task_start_time 0x000000d4 +#define AOFF_task_start_time 0x000000dc #define ASIZ_task_start_time 0x00000004 -#define AOFF_task_per_cpu_utime 0x000000d8 +#define AOFF_task_per_cpu_utime 0x000000e0 #define ASIZ_task_per_cpu_utime 0x00000080 -#define AOFF_task_min_flt 0x000001d8 +#define AOFF_task_min_flt 0x000001e0 #define ASIZ_task_min_flt 0x00000004 -#define AOFF_task_maj_flt 0x000001dc +#define AOFF_task_maj_flt 0x000001e4 #define ASIZ_task_maj_flt 0x00000004 -#define AOFF_task_nswap 0x000001e0 +#define AOFF_task_nswap 0x000001e8 #define ASIZ_task_nswap 0x00000004 -#define AOFF_task_cmin_flt 0x000001e4 +#define AOFF_task_cmin_flt 0x000001ec #define ASIZ_task_cmin_flt 0x00000004 -#define AOFF_task_cmaj_flt 0x000001e8 +#define AOFF_task_cmaj_flt 0x000001f0 #define ASIZ_task_cmaj_flt 0x00000004 -#define AOFF_task_cnswap 0x000001ec +#define AOFF_task_cnswap 0x000001f4 #define ASIZ_task_cnswap 0x00000004 -#define AOFF_task_swap_address 0x000001f4 -#define ASIZ_task_swap_address 0x00000004 -#define AOFF_task_old_maj_flt 0x000001f8 -#define ASIZ_task_old_maj_flt 0x00000004 -#define AOFF_task_dec_flt 0x000001fc -#define ASIZ_task_dec_flt 0x00000004 -#define AOFF_task_swap_cnt 0x00000200 -#define ASIZ_task_swap_cnt 0x00000004 -#define AOFF_task_uid 0x00000204 +#define AOFF_task_uid 0x000001fa #define ASIZ_task_uid 0x00000002 -#define AOFF_task_euid 0x00000206 +#define AOFF_task_euid 0x000001fc #define ASIZ_task_euid 0x00000002 -#define AOFF_task_suid 0x00000208 +#define AOFF_task_suid 0x000001fe #define ASIZ_task_suid 0x00000002 -#define AOFF_task_fsuid 0x0000020a +#define AOFF_task_fsuid 0x00000200 #define ASIZ_task_fsuid 0x00000002 -#define AOFF_task_gid 0x0000020c +#define AOFF_task_gid 0x00000202 #define ASIZ_task_gid 0x00000002 -#define AOFF_task_egid 0x0000020e +#define AOFF_task_egid 0x00000204 #define ASIZ_task_egid 0x00000002 -#define AOFF_task_sgid 0x00000210 +#define AOFF_task_sgid 0x00000206 #define ASIZ_task_sgid 0x00000002 -#define AOFF_task_fsgid 0x00000212 +#define AOFF_task_fsgid 0x00000208 #define ASIZ_task_fsgid 0x00000002 -#define AOFF_task_ngroups 0x00000214 +#define AOFF_task_ngroups 0x0000020c #define ASIZ_task_ngroups 0x00000004 -#define AOFF_task_groups 0x00000218 +#define AOFF_task_groups 0x00000210 #define ASIZ_task_groups 0x00000040 -#define AOFF_task_cap_effective 0x00000258 +#define AOFF_task_cap_effective 0x00000250 #define ASIZ_task_cap_effective 0x00000004 -#define AOFF_task_cap_inheritable 0x0000025c +#define AOFF_task_cap_inheritable 0x00000254 #define ASIZ_task_cap_inheritable 0x00000004 -#define AOFF_task_cap_permitted 0x00000260 +#define AOFF_task_cap_permitted 0x00000258 #define ASIZ_task_cap_permitted 0x00000004 -#define AOFF_task_user 0x00000264 +#define AOFF_task_user 0x0000025c #define ASIZ_task_user 0x00000004 -#define AOFF_task_rlim 0x00000268 +#define AOFF_task_rlim 0x00000260 #define ASIZ_task_rlim 0x00000050 -#define AOFF_task_used_math 0x000002b8 +#define AOFF_task_used_math 0x000002b0 #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_comm 0x000002ba +#define AOFF_task_comm 0x000002b2 #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x000002cc +#define AOFF_task_link_count 0x000002c4 #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x000002d0 +#define AOFF_task_tty 0x000002c8 #define ASIZ_task_tty 0x00000004 -#define AOFF_task_semundo 0x000002d4 +#define AOFF_task_semundo 0x000002cc #define ASIZ_task_semundo 0x00000004 -#define AOFF_task_semsleeping 0x000002d8 +#define AOFF_task_semsleeping 0x000002d0 #define ASIZ_task_semsleeping 0x00000004 -#define AOFF_task_tss 0x000002e0 +#define AOFF_task_tss 0x000002d8 #define ASIZ_task_tss 0x00000388 -#define AOFF_task_fs 0x00000668 +#define AOFF_task_fs 0x00000660 #define ASIZ_task_fs 0x00000004 -#define AOFF_task_files 0x0000066c +#define AOFF_task_files 0x00000664 #define ASIZ_task_files 0x00000004 -#define AOFF_task_mm 0x00000670 +#define AOFF_task_mm 0x00000668 #define ASIZ_task_mm 0x00000004 -#define AOFF_task_sigmask_lock 0x00000674 +#define AOFF_task_sigmask_lock 0x0000066c #define ASIZ_task_sigmask_lock 0x00000008 -#define AOFF_task_sig 0x0000067c +#define AOFF_task_sig 0x00000674 #define ASIZ_task_sig 0x00000004 -#define AOFF_task_signal 0x00000680 +#define AOFF_task_signal 0x00000678 #define ASIZ_task_signal 0x00000008 -#define AOFF_task_blocked 0x00000688 +#define AOFF_task_blocked 0x00000680 #define ASIZ_task_blocked 0x00000008 -#define AOFF_task_sigqueue 0x00000690 +#define AOFF_task_sigqueue 0x00000688 #define ASIZ_task_sigqueue 0x00000004 -#define AOFF_task_sigqueue_tail 0x00000694 +#define AOFF_task_sigqueue_tail 0x0000068c #define ASIZ_task_sigqueue_tail 0x00000004 -#define AOFF_task_sas_ss_sp 0x00000698 +#define AOFF_task_sas_ss_sp 0x00000690 #define ASIZ_task_sas_ss_sp 0x00000004 -#define AOFF_task_sas_ss_size 0x0000069c +#define AOFF_task_sas_ss_size 0x00000694 #define ASIZ_task_sas_ss_size 0x00000004 #define AOFF_mm_mmap 0x00000000 #define ASIZ_mm_mmap 0x00000004 -#define AOFF_mm_mmap_cache 0x00000004 +#define AOFF_mm_mmap_avl 0x00000004 +#define ASIZ_mm_mmap_avl 0x00000004 +#define AOFF_mm_mmap_cache 0x00000008 #define ASIZ_mm_mmap_cache 0x00000004 -#define AOFF_mm_pgd 0x00000008 +#define AOFF_mm_pgd 0x0000000c #define ASIZ_mm_pgd 0x00000004 -#define AOFF_mm_count 0x0000000c +#define AOFF_mm_count 0x00000010 #define ASIZ_mm_count 0x00000004 -#define AOFF_mm_map_count 0x00000010 +#define AOFF_mm_map_count 0x00000014 #define ASIZ_mm_map_count 0x00000004 -#define AOFF_mm_mmap_sem 0x00000014 +#define AOFF_mm_mmap_sem 0x00000018 #define ASIZ_mm_mmap_sem 0x0000000c -#define AOFF_mm_context 0x00000020 +#define AOFF_mm_context 0x00000024 #define ASIZ_mm_context 0x00000004 -#define AOFF_mm_start_code 0x00000024 +#define AOFF_mm_start_code 0x00000028 #define ASIZ_mm_start_code 0x00000004 -#define AOFF_mm_end_code 0x00000028 +#define AOFF_mm_end_code 0x0000002c #define ASIZ_mm_end_code 0x00000004 -#define AOFF_mm_start_data 0x0000002c +#define AOFF_mm_start_data 0x00000030 #define ASIZ_mm_start_data 0x00000004 -#define AOFF_mm_end_data 0x00000030 +#define AOFF_mm_end_data 0x00000034 #define ASIZ_mm_end_data 0x00000004 -#define AOFF_mm_start_brk 0x00000034 +#define AOFF_mm_start_brk 0x00000038 #define ASIZ_mm_start_brk 0x00000004 -#define AOFF_mm_brk 0x00000038 +#define AOFF_mm_brk 0x0000003c #define ASIZ_mm_brk 0x00000004 -#define AOFF_mm_start_stack 0x0000003c +#define AOFF_mm_start_stack 0x00000040 #define ASIZ_mm_start_stack 0x00000004 -#define AOFF_mm_arg_start 0x00000040 +#define AOFF_mm_arg_start 0x00000044 #define ASIZ_mm_arg_start 0x00000004 -#define AOFF_mm_arg_end 0x00000044 +#define AOFF_mm_arg_end 0x00000048 #define ASIZ_mm_arg_end 0x00000004 -#define AOFF_mm_env_start 0x00000048 +#define AOFF_mm_env_start 0x0000004c #define ASIZ_mm_env_start 0x00000004 -#define AOFF_mm_env_end 0x0000004c +#define AOFF_mm_env_end 0x00000050 #define ASIZ_mm_env_end 0x00000004 -#define AOFF_mm_rss 0x00000050 +#define AOFF_mm_rss 0x00000054 #define ASIZ_mm_rss 0x00000004 -#define AOFF_mm_total_vm 0x00000054 +#define AOFF_mm_total_vm 0x00000058 #define ASIZ_mm_total_vm 0x00000004 -#define AOFF_mm_locked_vm 0x00000058 +#define AOFF_mm_locked_vm 0x0000005c #define ASIZ_mm_locked_vm 0x00000004 -#define AOFF_mm_def_flags 0x0000005c +#define AOFF_mm_def_flags 0x00000060 #define ASIZ_mm_def_flags 0x00000004 -#define AOFF_mm_cpu_vm_mask 0x00000060 +#define AOFF_mm_cpu_vm_mask 0x00000064 #define ASIZ_mm_cpu_vm_mask 0x00000004 -#define AOFF_mm_segments 0x00000064 +#define AOFF_mm_swap_cnt 0x00000068 +#define ASIZ_mm_swap_cnt 0x00000004 +#define AOFF_mm_swap_address 0x0000006c +#define ASIZ_mm_swap_address 0x00000004 +#define AOFF_mm_segments 0x00000070 #define ASIZ_mm_segments 0x00000004 #define AOFF_thread_uwinmask 0x00000000 #define ASIZ_thread_uwinmask 0x00000004 @@ -548,6 +554,6 @@ #define AOFF_thread_new_signal 0x00000380 #define ASIZ_thread_new_signal 0x00000004 -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif /* __ASM_OFFSETS_H__ */ diff --git a/include/asm-sparc/asmmacro.h b/include/asm-sparc/asmmacro.h index ed49f6ea0..553495c08 100644 --- a/include/asm-sparc/asmmacro.h +++ b/include/asm-sparc/asmmacro.h @@ -26,7 +26,7 @@ #define GET_PROCESSOR_MID(reg, tmp) \ rd %tbr, %reg; \ - sethi C_LABEL(mid_xlate), %tmp; \ + sethi %hi(C_LABEL(mid_xlate)), %tmp; \ srl %reg, 12, %reg; \ or %tmp, %lo(C_LABEL(mid_xlate)), %tmp; \ and %reg, 3, %reg; \ @@ -34,7 +34,7 @@ #define GET_PROCESSOR_OFFSET(reg, tmp) \ GET_PROCESSOR_ID(reg) \ - sethi C_LABEL(cpu_offset), %tmp; \ + sethi %hi(C_LABEL(cpu_offset)), %tmp; \ sll %reg, 2, %reg; \ or %tmp, %lo(C_LABEL(cpu_offset)), %tmp; \ ld [%tmp + %reg], %reg; diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h index b74eebb46..5b96e139b 100644 --- a/include/asm-sparc/atomic.h +++ b/include/asm-sparc/atomic.h @@ -9,16 +9,22 @@ #ifdef __SMP__ /* This is a temporary measure. -DaveM */ typedef struct { volatile int counter; } atomic_t; +#define ATOMIC_INIT(i) { (i << 8) } #else typedef struct { int counter; } atomic_t; +#define ATOMIC_INIT(i) { (i) } #endif -#define ATOMIC_INIT(i) { (i << 8) } - #ifdef __KERNEL__ #include <asm/system.h> #include <asm/psr.h> +#ifndef __SMP__ + +#define atomic_read(v) ((v)->counter) +#define atomic_set(v, i) (((v)->counter) = i) + +#else /* We do the bulk of the actual work out of line in two common * routines in assembler, see arch/sparc/lib/atomic.S for the * "fun" details. @@ -35,14 +41,16 @@ typedef struct { int counter; } atomic_t; static __inline__ int atomic_read(atomic_t *v) { - int val; + int ret = v->counter; + + while(ret & 0xff) + ret = v->counter; - __asm__ __volatile__("sra %1, 0x8, %0" - : "=r" (val) - : "r" (v->counter)); - return val; + return ret >> 8; } + #define atomic_set(v, i) (((v)->counter) = ((i) << 8)) +#endif /* Make sure gcc doesn't try to be clever and move things around * on us. We need to use _exactly_ the address the user gave us, diff --git a/include/asm-sparc/cache.h b/include/asm-sparc/cache.h index 55475a5a1..19885d7e9 100644 --- a/include/asm-sparc/cache.h +++ b/include/asm-sparc/cache.h @@ -1,4 +1,4 @@ -/* $Id: cache.h,v 1.7 1997/05/06 09:31:46 davem Exp $ +/* $Id: cache.h,v 1.8 1999/03/11 00:14:45 davem Exp $ * cache.h: Cache specific code for the Sparc. These include flushing * and direct tag/data line access. * @@ -13,6 +13,8 @@ #define L1_CACHE_BYTES 32 #define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))) +#define SMP_CACHE_BYTES 32 + /* Direct access to the instruction cache is provided through and * alternate address space. The IDC bit must be off in the ICCR on * HyperSparcs for these accesses to work. The code below does not do diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h index 90bb1976a..e552cfc6a 100644 --- a/include/asm-sparc/checksum.h +++ b/include/asm-sparc/checksum.h @@ -1,4 +1,4 @@ -/* $Id: checksum.h,v 1.28 1998/04/17 02:37:25 davem Exp $ */ +/* $Id: checksum.h,v 1.29 1999/03/21 05:22:07 davem Exp $ */ #ifndef __SPARC_CHECKSUM_H #define __SPARC_CHECKSUM_H @@ -117,7 +117,10 @@ csum_partial_copy_to_user(const char *src, char *dst, int len, return ret; } } - + +#define HAVE_CSUM_COPY_USER +#define csum_and_copy_to_user csum_partial_copy_to_user + /* ihl is always 5 or greater, almost always is 5, and iph is word aligned * the majority of the time. */ diff --git a/include/asm-sparc/dma.h b/include/asm-sparc/dma.h index 7c502a17a..133e497c4 100644 --- a/include/asm-sparc/dma.h +++ b/include/asm-sparc/dma.h @@ -1,4 +1,4 @@ -/* $Id: dma.h,v 1.28 1998/10/26 20:03:09 davem Exp $ +/* $Id: dma.h,v 1.29 1998/11/29 15:49:44 davem Exp $ * include/asm-sparc/dma.h * * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu) @@ -127,6 +127,7 @@ extern void dvma_init(struct linux_sbus *); #define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */ #define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */ #define DMA_TERM_CNTR 0x00004000 /* Terminal counter */ +#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */ #define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */ #define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */ #define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */ @@ -147,6 +148,7 @@ extern void dvma_init(struct linux_sbus *); #define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */ #define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */ #define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */ +#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */ /* Values describing the burst-size property from the PROM */ #define DMA_BURST1 0x01 diff --git a/include/asm-sparc/ethtool.h b/include/asm-sparc/ethtool.h new file mode 100644 index 000000000..bea36b6c6 --- /dev/null +++ b/include/asm-sparc/ethtool.h @@ -0,0 +1,79 @@ +/* $Id: ethtool.h,v 1.1 1998/12/19 15:09:38 davem Exp $ + * ethtool.h: Defines for SparcLinux ethtool. + * + * Copyright (C) 1998 David S. Miller (davem@dm.cobaltmicro.com) + */ + +#ifndef _SPARC_ETHTOOL_H +#define _SPARC_ETHTOOL_H + +/* We do things like this so it does not matter what kernel + * headers you have on your system etc. + */ +#undef SIOCETHTOOL +#define SIOCETHTOOL (SIOCDEVPRIVATE + 0x0f) + +/* This should work for both 32 and 64 bit userland. */ +struct ethtool_cmd { + u32 cmd; + u32 supported; + u16 speed; + u8 duplex; + u8 port; + u8 phy_address; + u8 transceiver; + u8 autoneg; +}; + +/* CMDs currently supported */ +#define SPARC_ETH_GSET 0x00000001 /* Get settings, non-privileged. */ +#define SPARC_ETH_SSET 0x00000002 /* Set settings, privileged. */ + +/* Indicates what features are supported by the interface. */ +#define SUPPORTED_10baseT_Half 0x00000001 +#define SUPPORTED_10baseT_Full 0x00000002 +#define SUPPORTED_100baseT_Half 0x00000004 +#define SUPPORTED_100baseT_Full 0x00000008 +#define SUPPORTED_1000baseT_Half 0x00000010 +#define SUPPORTED_1000baseT_Full 0x00000020 +#define SUPPORTED_Autoneg 0x00000040 +#define SUPPORTED_TP 0x00000080 +#define SUPPORTED_AUI 0x00000100 +#define SUPPORTED_MII 0x00000200 +#define SUPPORTED_FIBRE 0x00000400 + +/* The following are all involved in forcing a particular link + * mode for the device for setting things. When getting the + * devices settings, these indicate the current mode and whether + * it was foced up into this mode or autonegotiated. + */ + +/* The forced speec, 10Mb, 100Mb, gigabit. */ +#define SPEED_10 10 +#define SPEED_100 100 +#define SPEED_1000 1000 + +/* Duplex, half or full. */ +#define DUPLEX_HALF 0x00 +#define DUPLEX_FULL 0x01 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 + +/* Which tranceiver to use. */ +#define XCVR_INTERNAL 0x00 +#define XCVR_EXTERNAL 0x01 +#define XCVR_DUMMY1 0x02 +#define XCVR_DUMMY2 0x03 +#define XCVR_DUMMY3 0x04 + +/* Enable or disable autonegotiation. If this is set to enable, + * the forced link modes above are completely ignored. + */ +#define AUTONEG_DISABLE 0x00 +#define AUTONEG_ENABLE 0x01 + +#endif /* _SPARC_ETHTOOL_H */ diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h index a653498c9..a8e415dbd 100644 --- a/include/asm-sparc/floppy.h +++ b/include/asm-sparc/floppy.h @@ -15,6 +15,14 @@ #include <asm/auxio.h> #include <asm/irq.h> +/* We don't need no stinkin' I/O port allocation crap. */ +#undef release_region +#undef check_region +#undef request_region +#define release_region(X, Y) do { } while(0) +#define check_region(X, Y) (0) +#define request_region(X, Y, Z) do { } while(0) + /* References: * 1) Netbsd Sun floppy driver. * 2) NCR 82077 controller manual @@ -101,6 +109,7 @@ static int FDC2=-1; /* Routines unique to each controller type on a Sun. */ static unsigned char sun_82072_fd_inb(int port) { + udelay(5); switch(port & 7) { default: printk("floppy: Asked to read unknown port %d\n", port); @@ -117,6 +126,7 @@ static unsigned char sun_82072_fd_inb(int port) static void sun_82072_fd_outb(unsigned char value, int port) { + udelay(5); switch(port & 7) { default: printk("floppy: Asked to write to unknown port %d\n", port); @@ -152,6 +162,7 @@ static void sun_82072_fd_outb(unsigned char value, int port) static unsigned char sun_82077_fd_inb(int port) { + udelay(5); switch(port & 7) { default: printk("floppy: Asked to read unknown port %d\n", port); @@ -169,6 +180,7 @@ static unsigned char sun_82077_fd_inb(int port) static void sun_82077_fd_outb(unsigned char value, int port) { + udelay(5); switch(port & 7) { default: printk("floppy: Asked to write to unknown port %d\n", port); @@ -318,8 +330,7 @@ static int sun_floppy_init(void) "floppy", fd_regs[0].which_io, 0x0); - release_region((long)sun_fdc & PAGE_MASK, - (((long)sun_fdc & ~PAGE_MASK) + fd_regs[0].reg_size + PAGE_SIZE - 1) & PAGE_MASK); + /* Last minute sanity check... */ if(sun_fdc->status_82072 == 0xff) { sun_fdc = NULL; @@ -339,6 +350,7 @@ static int sun_floppy_init(void) } /* Success... */ + allowed_drive_mask = 0x01; return (int) sun_fdc; no_sun_fdc: diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h index 359ad6e4d..12452e839 100644 --- a/include/asm-sparc/hardirq.h +++ b/include/asm-sparc/hardirq.h @@ -1,7 +1,7 @@ /* hardirq.h: 32-bit Sparc hard IRQ support. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1998 Anton Blanchard (anton@progsoc.uts.edu.au) + * Copyright (C) 1998-99 Anton Blanchard (anton@progsoc.uts.edu.au) */ #ifndef __SPARC_HARDIRQ_H @@ -9,22 +9,20 @@ #include <linux/tasks.h> -extern unsigned int local_irq_count[NR_CPUS]; +#ifndef __SMP__ +extern unsigned int local_irq_count; /* * Are we in an interrupt context? Either doing bottom half * or hardware interrupt processing? */ -#define in_interrupt() ({ int __cpu = smp_processor_id(); \ - (local_irq_count[__cpu] + local_bh_count[__cpu] != 0); }) +#define in_interrupt() ((local_irq_count + local_bh_count) != 0) -#ifndef __SMP__ - -#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) +#define hardirq_trylock(cpu) (local_irq_count == 0) #define hardirq_endlock(cpu) do { } while (0) -#define hardirq_enter(cpu) (local_irq_count[cpu]++) -#define hardirq_exit(cpu) (local_irq_count[cpu]--) +#define hardirq_enter(cpu) (local_irq_count++) +#define hardirq_exit(cpu) (local_irq_count--) #define synchronize_irq() barrier() @@ -35,10 +33,18 @@ extern unsigned int local_irq_count[NR_CPUS]; #include <asm/system.h> #include <asm/smp.h> +extern unsigned int local_irq_count[NR_CPUS]; extern unsigned char global_irq_holder; extern spinlock_t global_irq_lock; extern atomic_t global_irq_count; +/* + * Are we in an interrupt context? Either doing bottom half + * or hardware interrupt processing? + */ +#define in_interrupt() ({ int __cpu = smp_processor_id(); \ + (local_irq_count[__cpu] + local_bh_count[__cpu] != 0); }) + static inline void release_irqlock(int cpu) { /* if we didn't own the irq lock, just ignore.. */ @@ -62,7 +68,8 @@ static inline void hardirq_exit(int cpu) static inline int hardirq_trylock(int cpu) { - return !atomic_read(&global_irq_count) && !*(((volatile unsigned char *)(&global_irq_lock))); + return (! atomic_read(&global_irq_count) && + ! spin_is_locked (&global_irq_lock)); } #define hardirq_endlock(cpu) do { } while (0) diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h index 94e6b8333..991584449 100644 --- a/include/asm-sparc/head.h +++ b/include/asm-sparc/head.h @@ -1,4 +1,4 @@ -/* $Id: head.h,v 1.35 1998/03/18 09:15:40 jj Exp $ */ +/* $Id: head.h,v 1.36 1999/04/20 13:22:42 anton Exp $ */ #ifndef __SPARC_HEAD_H #define __SPARC_HEAD_H @@ -8,8 +8,6 @@ #define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2) /* Used in boot remapping. */ #define INTS_ENAB 0x01 /* entry.S uses this. */ -#define NCPUS 4 /* Architectural limit of sun4m. */ - #define SUN4_PROM_VECTOR 0xFFE81000 /* SUN4 PROM needs to be hardwired */ #define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */ diff --git a/include/asm-sparc/init.h b/include/asm-sparc/init.h index eddd82ca8..b5b1bbc47 100644 --- a/include/asm-sparc/init.h +++ b/include/asm-sparc/init.h @@ -7,6 +7,8 @@ #define __initfunc(__arginit) \ __arginit __init; \ __arginit +#define __cacheline_aligned __attribute__ \ + ((__section__ (".data.cacheline_aligned"))) /* For assembly routines */ #define __INIT .section ".text.init",#alloc,#execinstr #define __FINIT .previous @@ -15,6 +17,7 @@ #define __init #define __initdata #define __initfunc(__arginit) __arginit +#define __cacheline_aligned /* For assembly routines */ #define __INIT #define __FINIT diff --git a/include/asm-sparc/io-unit.h b/include/asm-sparc/io-unit.h index aac5f374c..fa020cd3f 100644 --- a/include/asm-sparc/io-unit.h +++ b/include/asm-sparc/io-unit.h @@ -27,14 +27,18 @@ #define IOUNIT_DVMA_SIZE 0x00100000 /* 1M */ /* The format of an iopte in the external page tables */ -#define IOUPTE_PAGE 0xffffff00 /* Physical page number (PA[35:12]) */ -#define IOUPTE_CACHE 0x00000080 /* Cached (in Viking/MXCC) */ -#define IOUPTE_STREAM 0x00000040 -#define IOUPTE_INTRA 0x00000008 /* Not regular memory - probably direct sbus<->sbus dma - FIXME: Play with this and find out how we can make use of this */ -#define IOUPTE_WRITE 0x00000004 /* Writeable */ -#define IOUPTE_VALID 0x00000002 /* IOPTE is valid */ -#define IOUPTE_PARITY 0x00000001 +#define IOUPTE_PAGE 0xffffff00 /* Physical page number (PA[35:12]) */ +#define IOUPTE_CACHE 0x00000080 /* Cached (in Viking/MXCC) */ +/* XXX Jakub, find out how to program SBUS streaming cache on XDBUS/sun4d. + * XXX Actually, all you should need to do is find out where the registers + * XXX are and copy over the sparc64 implementation I wrote. There may be + * XXX some horrible hwbugs though, so be careful. -DaveM + */ +#define IOUPTE_STREAM 0x00000040 /* Translation can use streaming cache */ +#define IOUPTE_INTRA 0x00000008 /* SBUS direct slot->slot transfer */ +#define IOUPTE_WRITE 0x00000004 /* Writeable */ +#define IOUPTE_VALID 0x00000002 /* IOPTE is valid */ +#define IOUPTE_PARITY 0x00000001 /* Parity is checked during DVMA */ struct iounit_struct { unsigned int bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned int)]; diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h index 342c90e64..38e861eb6 100644 --- a/include/asm-sparc/irq.h +++ b/include/asm-sparc/irq.h @@ -1,4 +1,4 @@ -/* $Id: irq.h,v 1.25 1998/06/04 09:55:04 jj Exp $ +/* $Id: irq.h,v 1.26 1999/04/20 13:22:44 anton Exp $ * irq.h: IRQ registers on the Sparc. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -8,8 +8,9 @@ #define _SPARC_IRQ_H #include <linux/linkage.h> +#include <linux/tasks.h> /* For NR_CPUS */ -#include <asm/system.h> /* For NCPUS */ +#include <asm/system.h> /* For SUN4M_NCPUS */ #include <asm/btfixup.h> #define __irq_ino(irq) irq @@ -19,46 +20,18 @@ BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int) #define NR_IRQS 15 -/* Get rid of this when lockups have gone away. -DaveM */ -#ifndef DEBUG_IRQLOCK -#define DEBUG_IRQLOCK -#endif - /* IRQ handler dispatch entry and exit. */ #ifdef __SMP__ -#ifdef DEBUG_IRQLOCK -extern void irq_enter(int cpu, int irq, void *regs); -extern void irq_exit(int cpu, int irq); -#else -extern __inline__ void irq_enter(int cpu, int irq, void *regs) -{ - register int proc asm("g1"); - proc = cpu; - __asm__ __volatile__(" - mov %%o7, %%g4 - call ___irq_enter - add %%o7, 8, %%o7 -" : "=&r" (proc) - : "0" (proc) - : "g2", "g3", "g4", "g5", "memory", "cc"); -} - -extern __inline__ void irq_exit(int cpu, int irq) -{ - register int proc asm("g7"); - proc = cpu; - __asm__ __volatile__(" - mov %%o7, %%g4 - call ___irq_exit - add %%o7, 8, %%o7 -" : "=&r" (proc) - : "0" (proc) - : "g1", "g2", "g3", "g4", "g5", "memory", "cc"); -} -#endif /* DEBUG_IRQLOCK */ +extern unsigned int local_irq_count[NR_CPUS]; +#define irq_enter(cpu, irq) \ +do { hardirq_enter(cpu); \ + spin_unlock_wait(&global_irq_lock); \ + } while(0) +#define irq_exit(cpu, irq) hardirq_exit(cpu) #else -#define irq_enter(cpu, irq, regs) (local_irq_count[cpu]++) -#define irq_exit(cpu, irq) (local_irq_count[cpu]--) +extern unsigned int local_irq_count; +#define irq_enter(cpu, irq) (local_irq_count++) +#define irq_exit(cpu, irq) (local_irq_count--) #endif /* Dave Redman (djhr@tadpole.co.uk) @@ -133,7 +106,7 @@ struct sun4m_intreg_percpu { * sun4m machines, for MP the layout makes more sense. */ struct sun4m_intregs { - struct sun4m_intreg_percpu cpu_intregs[NCPUS]; + struct sun4m_intreg_percpu cpu_intregs[SUN4M_NCPUS]; unsigned int tbt; /* IRQ's that are still pending. */ unsigned int irqs; /* Master IRQ bits. */ diff --git a/include/asm-sparc/keyboard.h b/include/asm-sparc/keyboard.h index 9dd63c3cb..7b1cbb0be 100644 --- a/include/asm-sparc/keyboard.h +++ b/include/asm-sparc/keyboard.h @@ -1,4 +1,4 @@ -/* $Id: keyboard.h,v 1.1 1998/09/22 05:54:42 jj Exp $ +/* $Id: keyboard.h,v 1.2 1999/04/28 11:59:07 davem Exp $ * linux/include/asm-sparc/keyboard.h * * sparc64 Created Aug 29 1997 by Eddie C. Dost (ecd@skynet.be) @@ -18,7 +18,6 @@ extern int pcikbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pcikbd_getkeycode(unsigned int scancode); -extern int pcikbd_pretranslate(unsigned char scancode, char raw_mode); extern int pcikbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pcikbd_unexpected_up(unsigned char keycode); @@ -28,7 +27,6 @@ extern unsigned char pcikbd_sysrq_xlate[128]; #define kbd_setkeycode pcikbd_setkeycode #define kbd_getkeycode pcikbd_getkeycode -#define kbd_pretranslate pcikbd_pretranslate #define kbd_translate pcikbd_translate #define kbd_unexpected_up pcikbd_unexpected_up #define kbd_leds pcikbd_leds diff --git a/include/asm-sparc/mmu_context.h b/include/asm-sparc/mmu_context.h index d73b71f94..d31a9ea6b 100644 --- a/include/asm-sparc/mmu_context.h +++ b/include/asm-sparc/mmu_context.h @@ -22,10 +22,8 @@ BTFIXUPDEF_CALL(void, destroy_context, struct mm_struct *) #define destroy_context(mm) BTFIXUP_CALL(destroy_context)(mm) -/* - * After we have set current->mm to a new value, this activates - * the context for the new mm so we see the new mappings. - * XXX this presumably needs a sensible implementation - paulus. +/* This need not do anything on Sparc32. The switch happens + * properly later as a side effect of calling flush_thread. */ #define activate_context(tsk) do { } while(0) diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h index 29f672eb5..8d6b911fc 100644 --- a/include/asm-sparc/namei.h +++ b/include/asm-sparc/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.12 1998/10/28 08:13:42 jj Exp $ +/* $Id: namei.h,v 1.13 1999/04/06 06:54:36 jj Exp $ * linux/include/asm-sparc/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -18,11 +18,8 @@ __sparc_lookup_dentry(const char *name, int lookup_flags) char *emul; switch (current->personality) { -#if 0 -/* Until we solve, why SunOS apps sometime crash, disable gnemul support for SunOS */ case PER_BSD: emul = SPARC_BSD_EMUL; break; -#endif case PER_SVR4: emul = SPARC_SOL_EMUL; break; default: diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 14513a0b6..57e46e7b0 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -19,6 +19,7 @@ #ifdef __KERNEL__ +#include <linux/config.h> #include <asm/head.h> /* for KERNBASE */ #include <asm/btfixup.h> diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 2de010213..76f7fc6bc 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.77 1998/08/04 20:51:19 davem Exp $ */ +/* $Id: pgtable.h,v 1.78 1999/01/07 14:14:05 jj Exp $ */ #ifndef _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H @@ -574,8 +574,10 @@ __get_iospace (unsigned long addr) #define module_map vmalloc #define module_unmap vfree +extern unsigned long *sparc_valid_addr_bitmap; /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (test_bit(PG_skip, &(page)->flags)) +#define kern_addr_valid(addr) (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) #endif /* !(_SPARC_PGTABLE_H) */ diff --git a/include/asm-sparc/posix_types.h b/include/asm-sparc/posix_types.h index a3fb5bb58..4ec175150 100644 --- a/include/asm-sparc/posix_types.h +++ b/include/asm-sparc/posix_types.h @@ -37,9 +37,15 @@ typedef long long __kernel_loff_t; #endif typedef struct { +#if defined(__KERNEL__) || defined(__USE_ALL) int val[2]; +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ + int __val[2]; +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ } __kernel_fsid_t; +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + #undef __FD_SET static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) { @@ -109,4 +115,6 @@ static __inline__ void __FD_ZERO(__kernel_fd_set *p) } } +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ + #endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */ diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h index 14a4621dd..f2ab4d947 100644 --- a/include/asm-sparc/processor.h +++ b/include/asm-sparc/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.67 1998/07/31 20:03:23 zaitcev Exp $ +/* $Id: processor.h,v 1.70 1999/03/24 11:42:44 davem Exp $ * include/asm-sparc/processor.h * * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) @@ -88,7 +88,7 @@ struct thread_struct { #define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */ #define INIT_MMAP { &init_mm, (0), (0), \ - __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } + NULL, __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_TSS { \ /* uwinmask, kregs, sig_address, sig_desc, ksp, kpc, kpsr, kwim */ \ @@ -145,8 +145,13 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, /* Free all resources held by a thread. */ #define release_thread(tsk) do { } while(0) +extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); -#define copy_segments(nr, tsk, mm) do { } while (0) + +#define copy_segments(__nr, __tsk, __mm) \ + if((__tsk) == current && \ + (__mm) != NULL) \ + flush_user_windows() #define release_segments(mm) do { } while (0) #define forget_segments() do { } while (0) diff --git a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h index bcfa8c06a..7e4f49093 100644 --- a/include/asm-sparc/resource.h +++ b/include/asm-sparc/resource.h @@ -1,4 +1,4 @@ -/* $Id: resource.h,v 1.6 1996/11/25 03:30:25 ecd Exp $ +/* $Id: resource.h,v 1.7 1998/11/19 20:01:44 davem Exp $ * resource.h: Resource definitions. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -29,7 +29,7 @@ #define INIT_RLIMITS \ { \ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ - {LONG_MAX, LONG_MAX}, {_STK_LIM, _STK_LIM}, \ + {LONG_MAX, LONG_MAX}, {_STK_LIM, LONG_MAX}, \ { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ {NR_OPEN, NR_OPEN}, {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX} \ diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h index e04656e6c..f4468fa58 100644 --- a/include/asm-sparc/sbus.h +++ b/include/asm-sparc/sbus.h @@ -1,4 +1,4 @@ -/* $Id: sbus.h,v 1.15 1998/05/22 14:33:36 jj Exp $ +/* $Id: sbus.h,v 1.16 1998/12/16 04:33:52 davem Exp $ * sbus.h: Defines for the Sun SBus. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -95,6 +95,13 @@ sbus_is_slave(struct linux_sbus_device *dev) #define for_all_sbusdev(device, bus) \ for((bus) = SBus_chain, (device) = (bus)->devices; (bus); (device)=((device)->next ? (device)->next : ((bus) = (bus)->next, (bus) ? (bus)->devices : 0))) +/* If you did not get the buffer from mmu_get_*() or sparc_alloc_dvma() + * then you must use this to get the 32-bit SBUS dvma address. + * And in this case it is your responsibility to make sure the buffer + * is GFP_DMA, ie. that it is not greater than MAX_DMA_ADDRESS. + */ +#define sbus_dvma_addr(__addr) ((__u32)(__addr)) + /* Apply promlib probed SBUS ranges to registers. */ extern void prom_apply_sbus_ranges(struct linux_sbus *sbus, struct linux_prom_registers *sbusregs, diff --git a/include/asm-sparc/semaphore-helper.h b/include/asm-sparc/semaphore-helper.h new file mode 100644 index 000000000..e3b5a8f88 --- /dev/null +++ b/include/asm-sparc/semaphore-helper.h @@ -0,0 +1,167 @@ +#ifndef _SPARC_SEMAPHORE_HELPER_H +#define _SPARC_SEMAPHORE_HELPER_H + +/* + * (barely) SMP- and interrupt-safe semaphore helper functions, sparc version. + * + * (C) Copyright 1999 David S. Miller (davem@redhat.com) + * (C) Copyright 1999 Jakub Jelinek (jj@ultra.linux.cz) + */ +#define wake_one_more(sem) atomic_inc(&(sem)->waking) +static __inline__ int waking_non_zero(struct semaphore *sem) +{ + int ret; + +#ifdef __SMP__ + int tmp; + + __asm__ __volatile__(" + rd %%psr, %%g1 + or %%g1, %3, %0 + wr %0, 0x0, %%psr + nop; nop; nop; +1: ldstub [%2 + 3], %0 + tst %0 + bne 1b + ld [%2], %0 + andn %0, 0xff, %1 + subcc %0, 0x1ff, %0 + bl,a 1f + mov 0, %0 + mov %0, %1 + mov 1, %0 +1: st %1, [%2] + wr %%g1, 0x0, %%psr + nop; nop; nop\n" + : "=&r" (ret), "=&r" (tmp) + : "r" (&sem->waking), "i" (PSR_PIL) + : "g1", "memory", "cc"); +#else + __asm__ __volatile__(" + rd %%psr, %%g1 + or %%g1, %2, %0 + wr %0, 0x0, %%psr + nop; nop; nop; + ld [%1], %0 + subcc %0, 1, %0 + bl,a 1f + mov 0, %0 + st %0, [%1] + mov 1, %0 +1: wr %%g1, 0x0, %%psr + nop; nop; nop\n" + : "=&r" (ret) + : "r" (&sem->waking), "i" (PSR_PIL) + : "g1", "memory", "cc"); +#endif + return ret; +} + +static __inline__ int waking_non_zero_interruptible(struct semaphore *sem, + struct task_struct *tsk) +{ + int ret; + +#ifdef __SMP__ + int tmp; + + __asm__ __volatile__(" + rd %%psr, %%g1 + or %%g1, %3, %0 + wr %0, 0x0, %%psr + nop; nop; nop; +1: ldstub [%2 + 3], %0 + tst %0 + bne 1b + ld [%2], %0 + andn %0, 0xff, %1 + subcc %0, 0x1ff, %0 + bl,a 1f + mov 0, %0 + mov %0, %1 + mov 1, %0 +1: st %1, [%2] + wr %%g1, 0x0, %%psr + nop; nop; nop\n" + : "=&r" (ret), "=&r" (tmp) + : "r" (&sem->waking), "i" (PSR_PIL) + : "g1", "memory", "cc"); +#else + __asm__ __volatile__(" + rd %%psr, %%g1 + or %%g1, %2, %0 + wr %0, 0x0, %%psr + nop; nop; nop; + ld [%1], %0 + subcc %0, 1, %0 + bl,a 1f + mov 0, %0 + st %0, [%1] + mov 1, %0 +1: wr %%g1, 0x0, %%psr + nop; nop; nop\n" + : "=&r" (ret) + : "r" (&sem->waking), "i" (PSR_PIL) + : "g1", "memory", "cc"); +#endif + if(ret == 0 && signal_pending(tsk)) { + atomic_inc(&sem->count); + ret = -EINTR; + } + return ret; +} + +static __inline__ int waking_non_zero_trylock(struct semaphore *sem) +{ + int ret; + +#ifdef __SMP__ + int tmp; + + __asm__ __volatile__(" + rd %%psr, %%g1 + or %%g1, %3, %0 + wr %0, 0x0, %%psr + nop; nop; nop; +1: ldstub [%2 + 3], %0 + tst %0 + bne 1b + ld [%2], %0 + andn %0, 0xff, %1 + subcc %0, 0x1ff, %0 + bl,a 1f + mov 0, %0 + mov %0, %1 + mov 1, %0 +1: st %1, [%2] + wr %%g1, 0x0, %%psr + nop; nop; nop\n" + : "=&r" (ret), "=&r" (tmp) + : "r" (&sem->waking), "i" (PSR_PIL) + : "g1", "memory", "cc"); +#else + __asm__ __volatile__(" + rd %%psr, %%g1 + or %%g1, %2, %0 + wr %0, 0x0, %%psr + nop; nop; nop; + ld [%1], %0 + subcc %0, 1, %0 + bl,a 1f + mov 0, %0 + st %0, [%1] + mov 1, %0 +1: wr %%g1, 0x0, %%psr + nop; nop; nop\n" + : "=&r" (ret) + : "r" (&sem->waking), "i" (PSR_PIL) + : "g1", "memory", "cc"); +#endif + ret = !ret; + if(ret == 1) + atomic_inc(&sem->count); + return ret; +} + +#endif /* !(_SPARC_SEMAPHORE_HELPER_H) */ + diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h index e9b490a5a..1123c966e 100644 --- a/include/asm-sparc/semaphore.h +++ b/include/asm-sparc/semaphore.h @@ -9,60 +9,148 @@ struct semaphore { atomic_t count; - int waking; + atomic_t waking; struct wait_queue * wait; }; -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, NULL }) +#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL }) +#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL }) extern void __down(struct semaphore * sem); extern int __down_interruptible(struct semaphore * sem); +extern int __down_trylock(struct semaphore * sem); extern void __up(struct semaphore * sem); #define sema_init(sem, val) atomic_set(&((sem)->count), val) -#define wake_one_more(sem) \ -do { \ - unsigned long flags; \ - save_and_cli(flags); \ - sem->waking++; \ - restore_flags(flags); \ -} while(0) - -#define waking_non_zero(sem,tsk)\ -({ unsigned long flags; \ - int ret = 0; \ - save_and_cli(flags); \ - if (sem->waking > 0) { \ - sem->waking--; \ - ret = 1; \ - } \ - restore_flags(flags); \ - ret; \ -}) - -/* This isn't quite as clever as the x86 side, I'll be fixing this - * soon enough. - */ extern inline void down(struct semaphore * sem) { - if (atomic_dec_return(&sem->count) < 0) - __down(sem); + register atomic_t *ptr asm("g1"); + register int increment asm("g2"); + + ptr = (atomic_t *) __atomic_fool_gcc(sem); + increment = 1; + + __asm__ __volatile__(" + mov %%o7, %%g4 + call ___atomic_sub + add %%o7, 8, %%o7 + tst %%g2 + bl 2f + nop +1: + .subsection 2 +2: save %%sp, -64, %%sp + mov %%g1, %%l1 + mov %%g5, %%l5 + call %3 + mov %%g1, %%o0 + mov %%l1, %%g1 + ba 1b + restore %%l5, %%g0, %%g5 + .previous\n" + : "=&r" (increment) + : "0" (increment), "r" (ptr), "i" (__down) + : "g3", "g4", "g7", "memory", "cc"); } extern inline int down_interruptible(struct semaphore * sem) { - int ret = 0; - if(atomic_dec_return(&sem->count) < 0) - ret = __down_interruptible(sem); - return ret; + register atomic_t *ptr asm("g1"); + register int increment asm("g2"); + + ptr = (atomic_t *) __atomic_fool_gcc(sem); + increment = 1; + + __asm__ __volatile__(" + mov %%o7, %%g4 + call ___atomic_sub + add %%o7, 8, %%o7 + tst %%g2 + bl 2f + clr %%g2 +1: + .subsection 2 +2: save %%sp, -64, %%sp + mov %%g1, %%l1 + mov %%g5, %%l5 + call %3 + mov %%g1, %%o0 + mov %%l1, %%g1 + mov %%l5, %%g5 + ba 1b + restore %%o0, %%g0, %%g2 + .previous\n" + : "=&r" (increment) + : "0" (increment), "r" (ptr), "i" (__down_interruptible) + : "g3", "g4", "g7", "memory", "cc"); + + return increment; +} + +extern inline int down_trylock(struct semaphore * sem) +{ + register atomic_t *ptr asm("g1"); + register int increment asm("g2"); + + ptr = (atomic_t *) __atomic_fool_gcc(sem); + increment = 1; + + __asm__ __volatile__(" + mov %%o7, %%g4 + call ___atomic_sub + add %%o7, 8, %%o7 + tst %%g2 + bl 2f + clr %%g2 +1: + .subsection 2 +2: save %%sp, -64, %%sp + mov %%g1, %%l1 + mov %%g5, %%l5 + call %3 + mov %%g1, %%o0 + mov %%l1, %%g1 + mov %%l5, %%g5 + ba 1b + restore %%o0, %%g0, %%g2 + .previous\n" + : "=&r" (increment) + : "0" (increment), "r" (ptr), "i" (__down_trylock) + : "g3", "g4", "g7", "memory", "cc"); + + return increment; } extern inline void up(struct semaphore * sem) { - if (atomic_inc_return(&sem->count) <= 0) - __up(sem); + register atomic_t *ptr asm("g1"); + register int increment asm("g2"); + + ptr = (atomic_t *) __atomic_fool_gcc(sem); + increment = 1; + + __asm__ __volatile__(" + mov %%o7, %%g4 + call ___atomic_add + add %%o7, 8, %%o7 + tst %%g2 + ble 2f + nop +1: + .subsection 2 +2: save %%sp, -64, %%sp + mov %%g1, %%l1 + mov %%g5, %%l5 + call %3 + mov %%g1, %%o0 + mov %%l1, %%g1 + ba 1b + restore %%l5, %%g0, %%g5 + .previous\n" + : "=&r" (increment) + : "0" (increment), "r" (ptr), "i" (__up) + : "g3", "g4", "g7", "memory", "cc"); } #endif /* __KERNEL__ */ diff --git a/include/asm-sparc/siginfo.h b/include/asm-sparc/siginfo.h index f20a5a81c..0a838c3a9 100644 --- a/include/asm-sparc/siginfo.h +++ b/include/asm-sparc/siginfo.h @@ -1,4 +1,4 @@ -/* $Id: siginfo.h,v 1.3 1998/08/26 10:33:29 davem Exp $ +/* $Id: siginfo.h,v 1.4 1999/04/28 19:45:20 davem Exp $ * siginfo.c: */ @@ -142,7 +142,7 @@ typedef struct siginfo { */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ -#define NSIGTRAP +#define NSIGTRAP 2 /* * SIGCHLD si_codes diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h index 91afa0840..e1ba06201 100644 --- a/include/asm-sparc/smp.h +++ b/include/asm-sparc/smp.h @@ -96,10 +96,6 @@ extern __volatile__ int cpu_number_map[NR_CPUS]; extern __volatile__ int __cpu_logical_map[NR_CPUS]; extern unsigned long smp_proc_in_lock[NR_CPUS]; -/* As idle task checks need_resched in a tight loop, it is not necessary to - wake it up. -jj */ -#define smp_send_reschedule(cpu) do {} while (0) - extern __inline__ int cpu_logical_map(int cpu) { return __cpu_logical_map[cpu]; @@ -161,6 +157,9 @@ extern __inline__ int hard_smp_processor_id(void) #endif #define smp_processor_id() hard_smp_processor_id() +/* XXX We really need to implement this now. -DaveM */ +extern __inline__ void smp_send_reschedule(int cpu) { } +extern __inline__ void smp_send_stop(void) { } #endif /* !(__ASSEMBLY__) */ @@ -178,10 +177,8 @@ extern __inline__ int hard_smp_processor_id(void) #define MBOX_IDLECPU2 0xFD #define MBOX_STOPCPU2 0xFE -#define PROC_CHANGE_PENALTY 20 +#define PROC_CHANGE_PENALTY 15 -#define SMP_FROM_INT 1 -#define SMP_FROM_SYSCALL 2 #endif /* !(__SMP__) */ #define NO_PROC_ID 0xFF diff --git a/include/asm-sparc/softirq.h b/include/asm-sparc/softirq.h index 80c5d2e3e..4920aa865 100644 --- a/include/asm-sparc/softirq.h +++ b/include/asm-sparc/softirq.h @@ -1,21 +1,23 @@ /* softirq.h: 32-bit Sparc soft IRQ support. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1998 Anton Blanchard (anton@progsoc.uts.edu.au) + * Copyright (C) 1998-99 Anton Blanchard (anton@progsoc.uts.edu.au) */ #ifndef __SPARC_SOFTIRQ_H #define __SPARC_SOFTIRQ_H +#include <linux/tasks.h> /* For NR_CPUS */ + #include <asm/atomic.h> #include <asm/smp.h> #include <asm/hardirq.h> -extern unsigned int local_bh_count[NR_CPUS]; #define get_active_bhs() (bh_mask & bh_active) #ifdef __SMP__ +extern unsigned int local_bh_count[NR_CPUS]; /* * The locking mechanism for base handlers, to prevent re-entrancy, @@ -23,7 +25,7 @@ extern unsigned int local_bh_count[NR_CPUS]; * referenced at all outside of this file. */ extern atomic_t global_bh_lock; -extern atomic_t global_bh_count; +extern spinlock_t global_bh_count; extern spinlock_t sparc_bh_lock; extern void synchronize_bh(void); @@ -41,7 +43,7 @@ extern inline void init_bh(int nr, void (*routine)(void)) unsigned long flags; spin_lock_irqsave(&sparc_bh_lock, flags); bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; spin_unlock_irqrestore(&sparc_bh_lock, flags); } @@ -50,8 +52,8 @@ extern inline void remove_bh(int nr) { unsigned long flags; spin_lock_irqsave(&sparc_bh_lock, flags); - bh_base[nr] = NULL; bh_mask &= ~(1 << nr); + bh_base[nr] = NULL; spin_unlock_irqrestore(&sparc_bh_lock, flags); } @@ -72,7 +74,7 @@ extern inline void disable_bh(int nr) unsigned long flags; spin_lock_irqsave(&sparc_bh_lock, flags); bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); spin_unlock_irqrestore(&sparc_bh_lock, flags); synchronize_bh(); } @@ -81,7 +83,7 @@ extern inline void enable_bh(int nr) { unsigned long flags; spin_lock_irqsave(&sparc_bh_lock, flags); - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; spin_unlock_irqrestore(&sparc_bh_lock, flags); } @@ -100,30 +102,31 @@ static inline void end_bh_atomic(void) /* These are for the IRQs testing the lock */ static inline int softirq_trylock(int cpu) { - if (atomic_add_return(1, &global_bh_count) == 1) { + if (spin_trylock(&global_bh_count)) { if (atomic_read(&global_bh_lock) == 0) { ++local_bh_count[cpu]; return 1; } + spin_unlock(&global_bh_count); } - atomic_dec(&global_bh_count); return 0; } static inline void softirq_endlock(int cpu) { local_bh_count[cpu]--; - atomic_dec(&global_bh_count); + spin_unlock(&global_bh_count); } #else +extern unsigned int local_bh_count; #define clear_active_bhs(x) (bh_active &= ~(x)) #define mark_bh(nr) (bh_active |= (1 << (nr))) /* These are for the irq's testing the lock */ -#define softirq_trylock(cpu) (local_bh_count[cpu] ? 0 : (local_bh_count[cpu]=1)) -#define softirq_endlock(cpu) (local_bh_count[cpu] = 0) +#define softirq_trylock(cpu) (local_bh_count ? 0 : (local_bh_count=1)) +#define softirq_endlock(cpu) (local_bh_count = 0) #define synchronize_bh() barrier() /* @@ -133,39 +136,40 @@ static inline void softirq_endlock(int cpu) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); synchronize_bh(); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } extern inline void remove_bh(int nr) { - bh_base[nr] = NULL; bh_mask &= ~(1 << nr); + mb(); + bh_base[nr] = NULL; } extern inline void start_bh_atomic(void) { - local_bh_count[0]++; + local_bh_count++; barrier(); } extern inline void end_bh_atomic(void) { barrier(); - local_bh_count[0]--; + local_bh_count--; } #endif /* SMP */ diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index e58ffe605..c676dcc4c 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h @@ -6,6 +6,8 @@ #ifndef __SPARC_SPINLOCK_H #define __SPARC_SPINLOCK_H +#include <linux/tasks.h> /* For NR_CPUS */ + #ifndef __ASSEMBLY__ #ifndef __SMP__ @@ -67,6 +69,7 @@ typedef struct _spinlock_debug spinlock_t; #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0 } #define spin_lock_init(lp) do { (lp)->owner_pc = 0; (lp)->lock = 0; } while(0) +#define spin_is_locked(lp) (*((volatile unsigned char *)(&((lp)->lock))) != 0) #define spin_unlock_wait(lp) do { barrier(); } while(*(volatile unsigned char *)(&(lp)->lock)) extern void _do_spin_lock(spinlock_t *lock, char *str); @@ -86,7 +89,7 @@ extern void _do_spin_unlock(spinlock_t *lock); struct _rwlock_debug { volatile unsigned int lock; unsigned long owner_pc; - unsigned long reader_pc[NCPUS]; + unsigned long reader_pc[NR_CPUS]; }; typedef struct _rwlock_debug rwlock_t; @@ -112,7 +115,7 @@ do { unsigned long flags; \ _do_read_unlock(lock, "read_unlock"); \ __restore_flags(flags); \ } while(0) -#define read_unlock_irq(lock) do { _do_read_unlock(lock, "read_unlock_irq"); __sti() } while(0) +#define read_unlock_irq(lock) do { _do_read_unlock(lock, "read_unlock_irq"); __sti(); } while(0) #define read_unlock_irqrestore(lock, flags) do { _do_read_unlock(lock, "read_unlock_irqrestore"); __restore_flags(flags); } while(0) #define write_lock(lock) \ @@ -139,7 +142,8 @@ typedef unsigned char spinlock_t; #define SPIN_LOCK_UNLOCKED 0 #define spin_lock_init(lock) (*(lock) = 0) -#define spin_unlock_wait(lock) do { barrier(); } while(*(volatile spinlock_t *)lock) +#define spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) +#define spin_unlock_wait(lock) do { barrier(); } while(*(volatile unsigned char *)lock) extern __inline__ void spin_lock(spinlock_t *lock) { @@ -209,10 +213,10 @@ extern __inline__ void spin_unlock_irq(spinlock_t *lock) : "g2", "memory"); } -#define spin_lock_irqsave(lock, flags) \ +#define spin_lock_irqsave(__lock, flags) \ do { \ - register spinlock_t *lp asm("g1"); \ - lp = lock; \ + register spinlock_t *__lp asm("g1"); \ + __lp = (__lock); \ __asm__ __volatile__( \ "rd %%psr, %0\n\t" \ "or %0, %1, %%g2\n\t" \ @@ -231,7 +235,7 @@ do { \ "b,a 1b\n\t" \ ".previous\n" \ : "=r" (flags) \ - : "i" (PSR_PIL), "r" (lp) \ + : "i" (PSR_PIL), "r" (__lp) \ : "g2", "memory", "cc"); \ } while(0) diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index 6dc074c78..3a4ee58a3 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.71 1998/10/13 03:51:06 jj Exp $ */ +/* $Id: system.h,v 1.74 1999/05/08 03:03:14 davem Exp $ */ #include <linux/config.h> #ifndef __SPARC_SYSTEM_H @@ -48,6 +48,8 @@ extern enum sparc_cpu sparc_cpu_model; #define ARCH_SUN4 1 #endif +#define SUN4M_NCPUS 4 /* Architectural limit of sun4m. */ + extern unsigned long empty_bad_page; extern unsigned long empty_bad_page_table; extern unsigned long empty_zero_page; @@ -82,8 +84,15 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, #define SWITCH_DO_LAZY_FPU if(last_task_used_math != next) next->tss.kregs->psr&=~PSR_EF; #endif - /* Much care has gone into this code, do not touch it. */ -#define switch_to(prev, next) do { \ + /* Much care has gone into this code, do not touch it. + * + * We need to loadup regs l0/l1 for the newly forked child + * case because the trap return path relies on those registers + * holding certain values, gcc is told that they are clobbered. + * Gcc needs registers for 3 values in and 1 value out, so we + * clobber every non-fixed-usage register besides l2/l3/o4/o5. -DaveM + */ +#define switch_to(prev, next, last) do { \ __label__ here; \ register unsigned long task_pc asm("o7"); \ extern struct task_struct *current_set[NR_CPUS]; \ @@ -101,21 +110,22 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, next->mm->cpu_vm_mask |= (1 << smp_processor_id()); \ task_pc = ((unsigned long) &&here) - 0x8; \ __asm__ __volatile__( \ + "mov %%g6, %%g3\n\t" \ "rd %%psr, %%g4\n\t" \ - "std %%sp, [%%g6 + %3]\n\t" \ + "std %%sp, [%%g6 + %4]\n\t" \ "rd %%wim, %%g5\n\t" \ "wr %%g4, 0x20, %%psr\n\t" \ "nop\n\t" \ - "std %%g4, [%%g6 + %2]\n\t" \ - "ldd [%1 + %2], %%g4\n\t" \ - "mov %1, %%g6\n\t" \ + "std %%g4, [%%g6 + %3]\n\t" \ + "ldd [%2 + %3], %%g4\n\t" \ + "mov %2, %%g6\n\t" \ ".globl patchme_store_new_current\n" \ "patchme_store_new_current:\n\t" \ - "st %1, [%0]\n\t" \ + "st %2, [%1]\n\t" \ "wr %%g4, 0x20, %%psr\n\t" \ "nop\n\t" \ "nop\n\t" \ - "ldd [%%g6 + %3], %%sp\n\t" \ + "ldd [%%g6 + %4], %%sp\n\t" \ "wr %%g5, 0x0, %%wim\n\t" \ "ldd [%%sp + 0x00], %%l0\n\t" \ "ldd [%%sp + 0x38], %%i6\n\t" \ @@ -123,11 +133,13 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, "nop\n\t" \ "nop\n\t" \ "jmpl %%o7 + 0x8, %%g0\n\t" \ - " nop\n\t" : : "r" (&(current_set[hard_smp_processor_id()])), "r" (next), \ + " mov %%g3, %0\n\t" \ + : "=&r" (last) \ + : "r" (&(current_set[hard_smp_processor_id()])), "r" (next), \ "i" ((const unsigned long)(&((struct task_struct *)0)->tss.kpsr)), \ "i" ((const unsigned long)(&((struct task_struct *)0)->tss.ksp)), \ "r" (task_pc) \ - : "g1", "g2", "g3", "g4", "g5", "g7", "l2", "l3", \ + : "g1", "g2", "g3", "g4", "g5", "g7", "l0", "l1", \ "l4", "l5", "l6", "l7", "i0", "i1", "i2", "i3", "i4", "i5", "o0", "o1", "o2", \ "o3"); \ here: } while(0) @@ -294,7 +306,9 @@ do { register unsigned long bits asm("g7"); \ #endif /* XXX Change this if we ever use a PSO mode kernel. */ -#define mb() __asm__ __volatile__ ("" : : : "memory") +#define mb() __asm__ __volatile__ ("" : : : "memory") +#define rmb() mb() +#define wmb() mb() #define nop() __asm__ __volatile__ ("nop"); diff --git a/include/asm-sparc/termbits.h b/include/asm-sparc/termbits.h index 1e4ed5e50..c0c4959a2 100644 --- a/include/asm-sparc/termbits.h +++ b/include/asm-sparc/termbits.h @@ -153,6 +153,22 @@ struct termios { #define B460800 0x00001004 /* This is what we can do with the Zilogs. */ #define B76800 0x00001005 +/* This is what we can do with the SAB82532. */ +#define B153600 0x00001006 +#define B307200 0x00001007 +#define B614400 0x00001008 +#define B921600 0x00001009 +/* And these are the rest... */ +#define B500000 0x0000100a +#define B576000 0x0000100b +#define B1000000 0x0000100c +#define B1152000 0x0000100d +#define B1500000 0x0000100e +#define B2000000 0x0000100f +#define B2500000 0x00001010 +#define B3000000 0x00001011 +#define B3500000 0x00001012 +#define B4000000 0x00001013 #define CIBAUD 0x100f0000 /* input baud rate (not used) */ #define CMSPAR 0x40000000 /* mark or space (stick) parity */ #define CRTSCTS 0x80000000 /* flow control */ diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h index d00d6558c..b24f9a324 100644 --- a/include/asm-sparc/termios.h +++ b/include/asm-sparc/termios.h @@ -1,4 +1,4 @@ -/* $Id: termios.h,v 1.27 1998/10/04 06:50:13 davem Exp $ */ +/* $Id: termios.h,v 1.29 1999/03/25 09:11:18 davem Exp $ */ #ifndef _SPARC_TERMIOS_H #define _SPARC_TERMIOS_H @@ -68,6 +68,7 @@ struct winsize { #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ #ifdef __KERNEL__ diff --git a/include/asm-sparc/timer.h b/include/asm-sparc/timer.h index 843ff4b7c..226937aca 100644 --- a/include/asm-sparc/timer.h +++ b/include/asm-sparc/timer.h @@ -1,4 +1,4 @@ -/* $Id: timer.h,v 1.20 1998/09/21 05:07:37 jj Exp $ +/* $Id: timer.h,v 1.21 1999/04/20 13:22:51 anton Exp $ * timer.h: Definitions for the timer chips on the Sparc. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -9,7 +9,7 @@ #ifndef _SPARC_TIMER_H #define _SPARC_TIMER_H -#include <asm/system.h> /* For NCPUS */ +#include <asm/system.h> /* For SUN4M_NCPUS */ #include <asm/sun4paddr.h> #include <asm/btfixup.h> @@ -70,7 +70,7 @@ struct sun4m_timer_percpu_info { }; struct sun4m_timer_regs { - struct sun4m_timer_percpu_info cpu_timers[NCPUS]; + struct sun4m_timer_percpu_info cpu_timers[SUN4M_NCPUS]; volatile unsigned int l10_timer_limit; volatile unsigned int l10_cur_count; diff --git a/include/asm-sparc/timex.h b/include/asm-sparc/timex.h index 4b2b3850f..4b628788b 100644 --- a/include/asm-sparc/timex.h +++ b/include/asm-sparc/timex.h @@ -12,4 +12,9 @@ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +/* XXX Maybe do something better at some point... -DaveM */ +typedef unsigned long cycles_t; +extern cycles_t cacheflush_time; +#define get_cycles() (0) + #endif diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h index a2affc181..56f81b81f 100644 --- a/include/asm-sparc/uaccess.h +++ b/include/asm-sparc/uaccess.h @@ -1,4 +1,4 @@ -/* $Id: uaccess.h,v 1.17 1998/09/16 12:25:29 jj Exp $ +/* $Id: uaccess.h,v 1.18 1999/03/30 06:38:38 jj Exp $ * uaccess.h: User space memore access functions. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -349,9 +349,8 @@ extern __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size) .align 4 .word 1f,3 .previous -1: mov %2, %%o1 - call __bzero +1: call __bzero mov %1, %%o0 mov %%o0, %0 " : "=r" (ret) : "r" (addr), "r" (size) : diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index 501197be4..139dc32b5 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h @@ -1,4 +1,4 @@ -/* $Id: unistd.h,v 1.48 1998/10/07 01:27:50 davem Exp $ */ +/* $Id: unistd.h,v 1.55 1999/04/07 17:14:15 davem Exp $ */ #ifndef _SPARC_UNISTD_H #define _SPARC_UNISTD_H @@ -28,29 +28,29 @@ #define __NR_unlink 10 /* Common */ #define __NR_execv 11 /* SunOS Specific */ #define __NR_chdir 12 /* Common */ -#define __NR_chown 13 /* Common */ +#define __NR_chown 13 /* Common */ #define __NR_mknod 14 /* Common */ #define __NR_chmod 15 /* Common */ #define __NR_lchown 16 /* Common */ #define __NR_brk 17 /* Common */ -/* #define __NR_ni_syscall 18 RESERVED for sparc64 perf-counter syscall */ +#define __NR_perfctr 18 /* Performance counter operations */ #define __NR_lseek 19 /* Common */ #define __NR_getpid 20 /* Common */ #define __NR_capget 21 /* Linux Specific */ #define __NR_capset 22 /* Linux Specific */ #define __NR_setuid 23 /* Implemented via setreuid in SunOS */ #define __NR_getuid 24 /* Common */ -/* #define __NR_ni_syscall 25 ENOSYS under SunOS */ +/* #define __NR_time alias 25 ENOSYS under SunOS */ #define __NR_ptrace 26 /* Common */ #define __NR_alarm 27 /* Implemented via setitimer in SunOS */ #define __NR_sigaltstack 28 /* Common */ #define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */ #define __NR_utime 30 /* Implemented via utimes() under SunOS */ -#define __NR_stty 31 /* Implemented via ioctl() under SunOS */ -#define __NR_gtty 32 /* Implemented via ioctl() under SunOS */ +/* #define __NR_stty 31 Implemented via ioctl() under SunOS */ +/* #define __NR_gtty 32 Implemented via ioctl() under SunOS */ #define __NR_access 33 /* Common */ #define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */ -#define __NR_ftime 35 /* Implemented via gettimeofday() in SunOS */ +/* #define __NR_ftime 35 Implemented via gettimeofday() in SunOS */ #define __NR_sync 36 /* Common */ #define __NR_kill 37 /* Common */ #define __NR_stat 38 /* Common */ @@ -59,16 +59,16 @@ #define __NR_dup 41 /* Common */ #define __NR_pipe 42 /* Common */ #define __NR_times 43 /* Implemented via getrusage() in SunOS */ -#define __NR_profil 44 /* Common */ -/* #define __NR_ni_syscall 45 ENOSYS under SunOS */ +/* #define __NR_profil 44 Common */ +#define __NR_umount2 45 /* Linux Specific */ #define __NR_setgid 46 /* Implemented via setregid() in SunOS */ #define __NR_getgid 47 /* Common */ #define __NR_signal 48 /* Implemented via sigvec() in SunOS */ #define __NR_geteuid 49 /* SunOS calls getuid() */ #define __NR_getegid 50 /* SunOS calls getgid() */ #define __NR_acct 51 /* Common */ -/* #define __NR_ni_syscall 52 ENOSYS under SunOS */ -#define __NR_mctl 53 /* SunOS specific */ +/* #define __NR_ni_syscall 52 ENOSYS under SunOS */ +/* #define __NR_mctl 53 SunOS specific */ #define __NR_ioctl 54 /* Common */ #define __NR_reboot 55 /* Common */ /* #define __NR_ni_syscall 56 ENOSYS under SunOS */ @@ -81,60 +81,60 @@ /* #define __NR_ni_syscall 63 ENOSYS under SunOS */ #define __NR_getpagesize 64 /* Common */ #define __NR_msync 65 /* Common in newer 1.3.x revs... */ -/* #define __NR_ni_syscall 66 ENOSYS under SunOS */ +#define __NR_vfork 66 /* Common */ #define __NR_pread 67 /* Linux Specific */ #define __NR_pwrite 68 /* Linux Specific */ -#define __NR_sbrk 69 /* SunOS Specific */ -#define __NR_sstk 70 /* SunOS Specific */ +/* #define __NR_sbrk 69 SunOS Specific */ +/* #define __NR_sstk 70 SunOS Specific */ #define __NR_mmap 71 /* Common */ -#define __NR_vadvise 72 /* SunOS Specific */ +/* #define __NR_vadvise 72 SunOS Specific */ #define __NR_munmap 73 /* Common */ #define __NR_mprotect 74 /* Common */ -#define __NR_madvise 75 /* SunOS Specific */ +/* #define __NR_madvise 75 SunOS Specific */ #define __NR_vhangup 76 /* Common */ /* #define __NR_ni_syscall 77 ENOSYS under SunOS */ -#define __NR_mincore 78 /* SunOS Specific */ +/* #define __NR_mincore 78 SunOS Specific */ #define __NR_getgroups 79 /* Common */ #define __NR_setgroups 80 /* Common */ #define __NR_getpgrp 81 /* Common */ -#define __NR_setpgrp 82 /* setpgid, same difference... */ +/* #define __NR_setpgrp 82 setpgid, same difference... */ #define __NR_setitimer 83 /* Common */ /* #define __NR_ni_syscall 84 ENOSYS under SunOS */ #define __NR_swapon 85 /* Common */ #define __NR_getitimer 86 /* Common */ -#define __NR_gethostname 87 /* SunOS Specific */ +/* #define __NR_gethostname 87 SunOS Specific */ #define __NR_sethostname 88 /* Common */ -#define __NR_getdtablesize 89 /* SunOS Specific */ +/* #define __NR_getdtablesize 89 SunOS Specific */ #define __NR_dup2 90 /* Common */ -#define __NR_getdopt 91 /* SunOS Specific */ +/* #define __NR_getdopt 91 SunOS Specific */ #define __NR_fcntl 92 /* Common */ #define __NR_select 93 /* Common */ -#define __NR_setdopt 94 /* SunOS Specific */ +/* #define __NR_setdopt 94 SunOS Specific */ #define __NR_fsync 95 /* Common */ #define __NR_setpriority 96 /* Common */ #define __NR_socket 97 /* Common */ #define __NR_connect 98 /* Common */ #define __NR_accept 99 /* Common */ #define __NR_getpriority 100 /* Common */ -#define __NR_rt_sigreturn 101 /* Linux Specific */ -#define __NR_rt_sigaction 102 /* Linux Specific */ -#define __NR_rt_sigprocmask 103 /* Linux Specific */ -#define __NR_rt_sigpending 104 /* Linux Specific */ -#define __NR_rt_sigtimedwait 105 /* Linux Specific */ -#define __NR_rt_sigqueueinfo 106 /* Linux Specific */ -#define __NR_rt_sigsuspend 107 /* Linux Specific */ -#define __NR_sigvec 108 /* SunOS Specific */ -#define __NR_sigblock 109 /* SunOS Specific */ -#define __NR_sigsetmask 110 /* SunOS Specific */ -#define __NR_sigpause 111 /* SunOS Specific */ -#define __NR_sigstack 112 /* SunOS Specific */ +#define __NR_rt_sigreturn 101 /* Linux Specific */ +#define __NR_rt_sigaction 102 /* Linux Specific */ +#define __NR_rt_sigprocmask 103 /* Linux Specific */ +#define __NR_rt_sigpending 104 /* Linux Specific */ +#define __NR_rt_sigtimedwait 105 /* Linux Specific */ +#define __NR_rt_sigqueueinfo 106 /* Linux Specific */ +#define __NR_rt_sigsuspend 107 /* Linux Specific */ +/* #define __NR_sigvec 108 SunOS Specific */ +/* #define __NR_sigblock 109 SunOS Specific */ +/* #define __NR_sigsetmask 110 SunOS Specific */ +/* #define __NR_sigpause 111 SunOS Specific */ +/* #define __NR_sigstack 112 SunOS Specific */ #define __NR_recvmsg 113 /* Common */ #define __NR_sendmsg 114 /* Common */ -#define __NR_vtrace 115 /* SunOS Specific */ +/* #define __NR_vtrace 115 SunOS Specific */ #define __NR_gettimeofday 116 /* Common */ #define __NR_getrusage 117 /* Common */ #define __NR_getsockopt 118 /* Common */ -#define __NR_getcwd 119 /* Linux Specific */ +#define __NR_getcwd 119 /* Linux Specific */ #define __NR_readv 120 /* Common */ #define __NR_writev 121 /* Common */ #define __NR_settimeofday 122 /* Common */ @@ -155,63 +155,63 @@ #define __NR_rmdir 137 /* Common */ #define __NR_utimes 138 /* SunOS Specific */ /* #define __NR_ni_syscall 139 ENOSYS under SunOS */ -#define __NR_adjtime 140 /* SunOS Specific */ +/* #define __NR_adjtime 140 SunOS Specific */ #define __NR_getpeername 141 /* Common */ -#define __NR_gethostid 142 /* SunOS Specific */ +/* #define __NR_gethostid 142 SunOS Specific */ /* #define __NR_ni_syscall 143 ENOSYS under SunOS */ #define __NR_getrlimit 144 /* Common */ #define __NR_setrlimit 145 /* Common */ -#define __NR_killpg 146 /* SunOS Specific */ +/* #define __NR_killpg 146 SunOS Specific */ #define __NR_prctl 147 /* ENOSYS under SunOS */ -#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ -#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ +#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ +#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ #define __NR_getsockname 150 /* Common */ -#define __NR_getmsg 151 /* SunOS Specific */ -#define __NR_putmsg 152 /* SunOS Specific */ +/* #define __NR_getmsg 151 SunOS Specific */ +/* #define __NR_putmsg 152 SunOS Specific */ #define __NR_poll 153 /* Common */ /* #define __NR_ni_syscall 154 ENOSYS under SunOS */ -#define __NR_nfssvc 155 /* SunOS Specific */ -#define __NR_getdirentries 156 /* SunOS Specific */ +/* #define __NR_nfssvc 155 SunOS Specific */ +/* #define __NR_getdirentries 156 SunOS Specific */ #define __NR_statfs 157 /* Common */ #define __NR_fstatfs 158 /* Common */ #define __NR_umount 159 /* Common */ -#define __NR_async_daemon 160 /* SunOS Specific */ -#define __NR_getfh 161 /* SunOS Specific */ +/* #define __NR_async_daemon 160 SunOS Specific */ +/* #define __NR_getfh 161 SunOS Specific */ #define __NR_getdomainname 162 /* SunOS Specific */ #define __NR_setdomainname 163 /* Common */ -/* #define __NR_ni_syscall 164 ENOSYS under SunOS */ +/* #define __NR_ni_syscall 164 ENOSYS under SunOS */ #define __NR_quotactl 165 /* Common */ -#define __NR_exportfs 166 /* SunOS Specific */ +/* #define __NR_exportfs 166 SunOS Specific */ #define __NR_mount 167 /* Common */ #define __NR_ustat 168 /* Common */ -#define __NR_semsys 169 /* SunOS Specific */ -#define __NR_msgsys 170 /* SunOS Specific */ -#define __NR_shmsys 171 /* SunOS Specific */ -#define __NR_auditsys 172 /* SunOS Specific */ -#define __NR_rfssys 173 /* SunOS Specific */ +/* #define __NR_semsys 169 SunOS Specific */ +/* #define __NR_msgsys 170 SunOS Specific */ +/* #define __NR_shmsys 171 SunOS Specific */ +/* #define __NR_auditsys 172 SunOS Specific */ +/* #define __NR_rfssys 173 SunOS Specific */ #define __NR_getdents 174 /* Common */ #define __NR_setsid 175 /* Common */ #define __NR_fchdir 176 /* Common */ -#define __NR_fchroot 177 /* SunOS Specific */ -#define __NR_vpixsys 178 /* SunOS Specific */ -#define __NR_aioread 179 /* SunOS Specific */ -#define __NR_aiowrite 180 /* SunOS Specific */ -#define __NR_aiowait 181 /* SunOS Specific */ -#define __NR_aiocancel 182 /* SunOS Specific */ +/* #define __NR_fchroot 177 SunOS Specific */ +/* #define __NR_vpixsys 178 SunOS Specific */ +/* #define __NR_aioread 179 SunOS Specific */ +/* #define __NR_aiowrite 180 SunOS Specific */ +/* #define __NR_aiowait 181 SunOS Specific */ +/* #define __NR_aiocancel 182 SunOS Specific */ #define __NR_sigpending 183 /* Common */ -#define __NR_query_module 184 /* Linux Specific */ +#define __NR_query_module 184 /* Linux Specific */ #define __NR_setpgid 185 /* Common */ -#define __NR_pathconf 186 /* SunOS Specific */ -#define __NR_fpathconf 187 /* SunOS Specific */ -#define __NR_sysconf 188 /* SunOS Specific */ +/* #define __NR_pathconf 186 SunOS Specific */ +/* #define __NR_fpathconf 187 SunOS Specific */ +/* #define __NR_sysconf 188 SunOS Specific */ #define __NR_uname 189 /* Linux Specific */ #define __NR_init_module 190 /* Linux Specific */ #define __NR_personality 191 /* Linux Specific */ -#define __NR_prof 192 /* Linux Specific */ -#define __NR_break 193 /* Linux Specific */ -#define __NR_lock 194 /* Linux Specific */ -#define __NR_mpx 195 /* Linux Specific */ -#define __NR_ulimit 196 /* Linux Specific */ +/* #define __NR_prof 192 Linux Specific */ +/* #define __NR_break 193 Linux Specific */ +/* #define __NR_lock 194 Linux Specific */ +/* #define __NR_mpx 195 Linux Specific */ +/* #define __NR_ulimit 196 Linux Specific */ #define __NR_getppid 197 /* Linux Specific */ #define __NR_sigaction 198 /* Linux Specific */ #define __NR_sgetmask 199 /* Linux Specific */ @@ -220,20 +220,20 @@ #define __NR_oldlstat 202 /* Linux Specific */ #define __NR_uselib 203 /* Linux Specific */ #define __NR_readdir 204 /* Linux Specific */ -#define __NR_ioperm 205 /* Linux Specific - i386 specific, unused */ +/* #define __NR_ioperm 205 Linux Specific - i386 specific, unused */ #define __NR_socketcall 206 /* Linux Specific */ #define __NR_syslog 207 /* Linux Specific */ -#define __NR_olduname 208 /* Linux Specific */ -#define __NR_iopl 209 /* Linux Specific - i386 specific, unused */ +/* #define __NR_olduname 208 Linux Specific */ +/* #define __NR_iopl 209 Linux Specific - i386 specific, unused */ #define __NR_idle 210 /* Linux Specific */ -#define __NR_vm86 211 /* Linux Specific - i386 specific, unused */ +/* #define __NR_vm86 211 Linux Specific - i386 specific, unused */ #define __NR_waitpid 212 /* Linux Specific */ #define __NR_swapoff 213 /* Linux Specific */ #define __NR_sysinfo 214 /* Linux Specific */ #define __NR_ipc 215 /* Linux Specific */ #define __NR_sigreturn 216 /* Linux Specific */ #define __NR_clone 217 /* Linux Specific */ -#define __NR_modify_ldt 218 /* Linux Specific - i386 specific, unused */ +/* #define __NR_modify_ldt 218 Linux Specific - i386 specific, unused */ #define __NR_adjtimex 219 /* Linux Specific */ #define __NR_sigprocmask 220 /* Linux Specific */ #define __NR_create_module 221 /* Linux Specific */ @@ -247,10 +247,10 @@ #define __NR_setfsgid 229 /* Linux Specific */ #define __NR__newselect 230 /* Linux Specific */ #define __NR_time 231 /* Linux Specific */ -#define __NR_oldstat 232 /* Linux Specific */ +/* #define __NR_oldstat 232 Linux Specific */ #define __NR_stime 233 /* Linux Specific */ -#define __NR_oldfstat 234 /* Linux Specific */ -#define __NR_phys 235 /* Linux Specific */ +/* #define __NR_oldfstat 234 Linux Specific */ +/* #define __NR_phys 235 Linux Specific */ #define __NR__llseek 236 /* Linux Specific */ #define __NR_mlock 237 #define __NR_munlock 238 @@ -428,6 +428,8 @@ static __inline__ _syscall0(int,pause) static __inline__ _syscall0(int,sync) static __inline__ _syscall0(pid_t,setsid) static __inline__ _syscall3(int,write,int,fd,__const__ char *,buf,off_t,count) +static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) +static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) static __inline__ _syscall1(int,dup,int,fd) static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp) static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode) @@ -441,40 +443,6 @@ static __inline__ pid_t wait(int * wait_stat) return waitpid(-1,wait_stat,0); } -/* - * This is the mechanism for creating a new kernel thread. - * - * NOTE! Only a kernel-only process(ie the swapper or direct descendants - * who haven't done an "execve()") should use this: it will work within - * a system call from a "real" process, but the process memory space will - * not be free'd until both the parent and the child have exited. - */ -static __inline__ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - long retval; - - __asm__ __volatile("mov %4, %%g2\n\t" /* Set aside fn ptr... */ - "mov %5, %%g3\n\t" /* and arg. */ - "mov %1, %%g1\n\t" - "mov %2, %%o0\n\t" /* Clone flags. */ - "mov 0, %%o1\n\t" /* usp arg == 0 */ - "t 0x10\n\t" /* Linux/Sparc clone(). */ - "cmp %%o1, 0\n\t" - "be 1f\n\t" /* The parent, just return. */ - " nop\n\t" /* Delay slot. */ - "jmpl %%g2, %%o7\n\t" /* Call the function. */ - " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */ - "mov %3, %%g1\n\t" - "t 0x10\n\t" /* Linux/Sparc exit(). */ - /* Notreached by child. */ - "1: mov %%o0, %0\n\t" : - "=r" (retval) : - "i" (__NR_clone), "r" (flags | CLONE_VM), - "i" (__NR_exit), "r" (fn), "r" (arg) : - "g1", "g2", "g3", "o0", "o1", "memory", "cc"); - return retval; -} - #endif /* __KERNEL_SYSCALLS__ */ #endif /* _SPARC_UNISTD_H */ diff --git a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h index 30e927b1b..7f5c464a4 100644 --- a/include/asm-sparc/vaddrs.h +++ b/include/asm-sparc/vaddrs.h @@ -1,4 +1,4 @@ -/* $Id: vaddrs.h,v 1.21 1996/10/07 03:03:02 davem Exp $ */ +/* $Id: vaddrs.h,v 1.22 1999/04/20 13:22:55 anton Exp $ */ #ifndef _SPARC_VADDRS_H #define _SPARC_VADDRS_H @@ -51,7 +51,7 @@ /* On sun4m machines we need per-cpu virtual areas */ #define PERCPU_VADDR 0xffc00000 /* Base for per-cpu virtual mappings */ #define PERCPU_ENTSIZE 0x00100000 -#define PERCPU_LEN ((PERCPU_ENTSIZE*NCPUS)) +#define PERCPU_LEN ((PERCPU_ENTSIZE*SUN4M_NCPUS)) /* per-cpu offsets */ #define PERCPU_TBR_OFFSET 0x00000 /* %tbr, mainly used for identification. */ diff --git a/include/asm-sparc64/asm_offsets.h b/include/asm-sparc64/asm_offsets.h index 52f6a9ee0..3301515c5 100644 --- a/include/asm-sparc64/asm_offsets.h +++ b/include/asm-sparc64/asm_offsets.h @@ -2,7 +2,9 @@ #ifndef __ASM_OFFSETS_H__ #define __ASM_OFFSETS_H__ -#ifndef __SMP__ +#include <linux/config.h> + +#ifndef CONFIG_SMP #define AOFF_task_state 0x00000000 #define ASIZ_task_state 0x00000008 @@ -20,220 +22,222 @@ #define ASIZ_task_counter 0x00000008 #define AOFF_task_priority 0x00000038 #define ASIZ_task_priority 0x00000008 -#define AOFF_task_has_cpu 0x00000040 +#define AOFF_task_avg_slice 0x00000040 +#define ASIZ_task_avg_slice 0x00000008 +#define AOFF_task_has_cpu 0x00000048 #define ASIZ_task_has_cpu 0x00000004 -#define AOFF_task_processor 0x00000044 +#define AOFF_task_processor 0x0000004c #define ASIZ_task_processor 0x00000004 -#define AOFF_task_last_processor 0x00000048 +#define AOFF_task_last_processor 0x00000050 #define ASIZ_task_last_processor 0x00000004 -#define AOFF_task_lock_depth 0x0000004c +#define AOFF_task_lock_depth 0x00000054 #define ASIZ_task_lock_depth 0x00000004 -#define AOFF_task_next_task 0x00000050 +#define AOFF_task_next_task 0x00000058 #define ASIZ_task_next_task 0x00000008 -#define AOFF_task_prev_task 0x00000058 +#define AOFF_task_prev_task 0x00000060 #define ASIZ_task_prev_task 0x00000008 -#define AOFF_task_next_run 0x00000060 +#define AOFF_task_next_run 0x00000068 #define ASIZ_task_next_run 0x00000008 -#define AOFF_task_prev_run 0x00000068 +#define AOFF_task_prev_run 0x00000070 #define ASIZ_task_prev_run 0x00000008 -#define AOFF_task_binfmt 0x00000070 +#define AOFF_task_binfmt 0x00000078 #define ASIZ_task_binfmt 0x00000008 -#define AOFF_task_exit_code 0x00000078 +#define AOFF_task_exit_code 0x00000080 #define ASIZ_task_exit_code 0x00000004 -#define AOFF_task_exit_signal 0x0000007c +#define AOFF_task_exit_signal 0x00000084 #define ASIZ_task_exit_signal 0x00000004 -#define AOFF_task_pdeath_signal 0x00000080 +#define AOFF_task_pdeath_signal 0x00000088 #define ASIZ_task_pdeath_signal 0x00000004 -#define AOFF_task_personality 0x00000088 +#define AOFF_task_personality 0x00000090 #define ASIZ_task_personality 0x00000008 -#define AOFF_task_pid 0x00000094 +#define AOFF_task_pid 0x0000009c #define ASIZ_task_pid 0x00000004 -#define AOFF_task_pgrp 0x00000098 +#define AOFF_task_pgrp 0x000000a0 #define ASIZ_task_pgrp 0x00000004 -#define AOFF_task_tty_old_pgrp 0x0000009c +#define AOFF_task_tty_old_pgrp 0x000000a4 #define ASIZ_task_tty_old_pgrp 0x00000004 -#define AOFF_task_session 0x000000a0 +#define AOFF_task_session 0x000000a8 #define ASIZ_task_session 0x00000004 -#define AOFF_task_leader 0x000000a4 +#define AOFF_task_leader 0x000000ac #define ASIZ_task_leader 0x00000004 -#define AOFF_task_p_opptr 0x000000a8 +#define AOFF_task_p_opptr 0x000000b0 #define ASIZ_task_p_opptr 0x00000008 -#define AOFF_task_p_pptr 0x000000b0 +#define AOFF_task_p_pptr 0x000000b8 #define ASIZ_task_p_pptr 0x00000008 -#define AOFF_task_p_cptr 0x000000b8 +#define AOFF_task_p_cptr 0x000000c0 #define ASIZ_task_p_cptr 0x00000008 -#define AOFF_task_p_ysptr 0x000000c0 +#define AOFF_task_p_ysptr 0x000000c8 #define ASIZ_task_p_ysptr 0x00000008 -#define AOFF_task_p_osptr 0x000000c8 +#define AOFF_task_p_osptr 0x000000d0 #define ASIZ_task_p_osptr 0x00000008 -#define AOFF_task_pidhash_next 0x000000d0 +#define AOFF_task_pidhash_next 0x000000d8 #define ASIZ_task_pidhash_next 0x00000008 -#define AOFF_task_pidhash_pprev 0x000000d8 +#define AOFF_task_pidhash_pprev 0x000000e0 #define ASIZ_task_pidhash_pprev 0x00000008 -#define AOFF_task_tarray_ptr 0x000000e0 +#define AOFF_task_tarray_ptr 0x000000e8 #define ASIZ_task_tarray_ptr 0x00000008 -#define AOFF_task_wait_chldexit 0x000000e8 +#define AOFF_task_wait_chldexit 0x000000f0 #define ASIZ_task_wait_chldexit 0x00000008 -#define AOFF_task_policy 0x000000f0 +#define AOFF_task_vfork_sem 0x000000f8 +#define ASIZ_task_vfork_sem 0x00000008 +#define AOFF_task_policy 0x00000100 #define ASIZ_task_policy 0x00000008 -#define AOFF_task_rt_priority 0x000000f8 +#define AOFF_task_rt_priority 0x00000108 #define ASIZ_task_rt_priority 0x00000008 -#define AOFF_task_it_real_value 0x00000100 +#define AOFF_task_it_real_value 0x00000110 #define ASIZ_task_it_real_value 0x00000008 -#define AOFF_task_it_prof_value 0x00000108 +#define AOFF_task_it_prof_value 0x00000118 #define ASIZ_task_it_prof_value 0x00000008 -#define AOFF_task_it_virt_value 0x00000110 +#define AOFF_task_it_virt_value 0x00000120 #define ASIZ_task_it_virt_value 0x00000008 -#define AOFF_task_it_real_incr 0x00000118 +#define AOFF_task_it_real_incr 0x00000128 #define ASIZ_task_it_real_incr 0x00000008 -#define AOFF_task_it_prof_incr 0x00000120 +#define AOFF_task_it_prof_incr 0x00000130 #define ASIZ_task_it_prof_incr 0x00000008 -#define AOFF_task_it_virt_incr 0x00000128 +#define AOFF_task_it_virt_incr 0x00000138 #define ASIZ_task_it_virt_incr 0x00000008 -#define AOFF_task_real_timer 0x00000130 +#define AOFF_task_real_timer 0x00000140 #define ASIZ_task_real_timer 0x00000028 -#define AOFF_task_times 0x00000158 +#define AOFF_task_times 0x00000168 #define ASIZ_task_times 0x00000020 -#define AOFF_task_start_time 0x00000178 +#define AOFF_task_start_time 0x00000188 #define ASIZ_task_start_time 0x00000008 -#define AOFF_task_per_cpu_utime 0x00000180 +#define AOFF_task_per_cpu_utime 0x00000190 #define ASIZ_task_per_cpu_utime 0x00000008 -#define AOFF_task_min_flt 0x00000190 +#define AOFF_task_min_flt 0x000001a0 #define ASIZ_task_min_flt 0x00000008 -#define AOFF_task_maj_flt 0x00000198 +#define AOFF_task_maj_flt 0x000001a8 #define ASIZ_task_maj_flt 0x00000008 -#define AOFF_task_nswap 0x000001a0 +#define AOFF_task_nswap 0x000001b0 #define ASIZ_task_nswap 0x00000008 -#define AOFF_task_cmin_flt 0x000001a8 +#define AOFF_task_cmin_flt 0x000001b8 #define ASIZ_task_cmin_flt 0x00000008 -#define AOFF_task_cmaj_flt 0x000001b0 +#define AOFF_task_cmaj_flt 0x000001c0 #define ASIZ_task_cmaj_flt 0x00000008 -#define AOFF_task_cnswap 0x000001b8 +#define AOFF_task_cnswap 0x000001c8 #define ASIZ_task_cnswap 0x00000008 -#define AOFF_task_swap_address 0x000001c8 -#define ASIZ_task_swap_address 0x00000008 -#define AOFF_task_old_maj_flt 0x000001d0 -#define ASIZ_task_old_maj_flt 0x00000008 -#define AOFF_task_dec_flt 0x000001d8 -#define ASIZ_task_dec_flt 0x00000008 -#define AOFF_task_swap_cnt 0x000001e0 -#define ASIZ_task_swap_cnt 0x00000008 -#define AOFF_task_uid 0x000001e8 +#define AOFF_task_uid 0x000001d4 #define ASIZ_task_uid 0x00000004 -#define AOFF_task_euid 0x000001ec +#define AOFF_task_euid 0x000001d8 #define ASIZ_task_euid 0x00000004 -#define AOFF_task_suid 0x000001f0 +#define AOFF_task_suid 0x000001dc #define ASIZ_task_suid 0x00000004 -#define AOFF_task_fsuid 0x000001f4 +#define AOFF_task_fsuid 0x000001e0 #define ASIZ_task_fsuid 0x00000004 -#define AOFF_task_gid 0x000001f8 +#define AOFF_task_gid 0x000001e4 #define ASIZ_task_gid 0x00000004 -#define AOFF_task_egid 0x000001fc +#define AOFF_task_egid 0x000001e8 #define ASIZ_task_egid 0x00000004 -#define AOFF_task_sgid 0x00000200 +#define AOFF_task_sgid 0x000001ec #define ASIZ_task_sgid 0x00000004 -#define AOFF_task_fsgid 0x00000204 +#define AOFF_task_fsgid 0x000001f0 #define ASIZ_task_fsgid 0x00000004 -#define AOFF_task_ngroups 0x00000208 +#define AOFF_task_ngroups 0x000001f4 #define ASIZ_task_ngroups 0x00000004 -#define AOFF_task_groups 0x0000020c +#define AOFF_task_groups 0x000001f8 #define ASIZ_task_groups 0x00000080 -#define AOFF_task_cap_effective 0x0000028c +#define AOFF_task_cap_effective 0x00000278 #define ASIZ_task_cap_effective 0x00000004 -#define AOFF_task_cap_inheritable 0x00000290 +#define AOFF_task_cap_inheritable 0x0000027c #define ASIZ_task_cap_inheritable 0x00000004 -#define AOFF_task_cap_permitted 0x00000294 +#define AOFF_task_cap_permitted 0x00000280 #define ASIZ_task_cap_permitted 0x00000004 -#define AOFF_task_user 0x00000298 +#define AOFF_task_user 0x00000288 #define ASIZ_task_user 0x00000008 -#define AOFF_task_rlim 0x000002a0 +#define AOFF_task_rlim 0x00000290 #define ASIZ_task_rlim 0x000000a0 -#define AOFF_task_used_math 0x00000340 +#define AOFF_task_used_math 0x00000330 #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_comm 0x00000342 +#define AOFF_task_comm 0x00000332 #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x00000354 +#define AOFF_task_link_count 0x00000344 #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x00000358 +#define AOFF_task_tty 0x00000348 #define ASIZ_task_tty 0x00000008 -#define AOFF_task_semundo 0x00000360 +#define AOFF_task_semundo 0x00000350 #define ASIZ_task_semundo 0x00000008 -#define AOFF_task_semsleeping 0x00000368 +#define AOFF_task_semsleeping 0x00000358 #define ASIZ_task_semsleeping 0x00000008 -#define AOFF_task_tss 0x00000370 +#define AOFF_task_tss 0x00000360 #define ASIZ_task_tss 0x00000470 -#define AOFF_task_fs 0x000007e0 +#define AOFF_task_fs 0x000007d0 #define ASIZ_task_fs 0x00000008 -#define AOFF_task_files 0x000007e8 +#define AOFF_task_files 0x000007d8 #define ASIZ_task_files 0x00000008 -#define AOFF_task_mm 0x000007f0 +#define AOFF_task_mm 0x000007e0 #define ASIZ_task_mm 0x00000008 -#define AOFF_task_sigmask_lock 0x000007f8 +#define AOFF_task_sigmask_lock 0x000007e8 #define ASIZ_task_sigmask_lock 0x00000001 -#define AOFF_task_sig 0x00000800 +#define AOFF_task_sig 0x000007f0 #define ASIZ_task_sig 0x00000008 -#define AOFF_task_signal 0x00000808 +#define AOFF_task_signal 0x000007f8 #define ASIZ_task_signal 0x00000008 -#define AOFF_task_blocked 0x00000810 +#define AOFF_task_blocked 0x00000800 #define ASIZ_task_blocked 0x00000008 -#define AOFF_task_sigqueue 0x00000818 +#define AOFF_task_sigqueue 0x00000808 #define ASIZ_task_sigqueue 0x00000008 -#define AOFF_task_sigqueue_tail 0x00000820 +#define AOFF_task_sigqueue_tail 0x00000810 #define ASIZ_task_sigqueue_tail 0x00000008 -#define AOFF_task_sas_ss_sp 0x00000828 +#define AOFF_task_sas_ss_sp 0x00000818 #define ASIZ_task_sas_ss_sp 0x00000008 -#define AOFF_task_sas_ss_size 0x00000830 +#define AOFF_task_sas_ss_size 0x00000820 #define ASIZ_task_sas_ss_size 0x00000008 -#define ASIZ_task 0x00000840 +#define ASIZ_task 0x00000830 #define AOFF_mm_mmap 0x00000000 #define ASIZ_mm_mmap 0x00000008 -#define AOFF_mm_mmap_cache 0x00000008 +#define AOFF_mm_mmap_avl 0x00000008 +#define ASIZ_mm_mmap_avl 0x00000008 +#define AOFF_mm_mmap_cache 0x00000010 #define ASIZ_mm_mmap_cache 0x00000008 -#define AOFF_mm_pgd 0x00000010 +#define AOFF_mm_pgd 0x00000018 #define ASIZ_mm_pgd 0x00000008 -#define AOFF_mm_count 0x00000018 +#define AOFF_mm_count 0x00000020 #define ASIZ_mm_count 0x00000004 -#define AOFF_mm_map_count 0x0000001c +#define AOFF_mm_map_count 0x00000024 #define ASIZ_mm_map_count 0x00000004 -#define AOFF_mm_mmap_sem 0x00000020 +#define AOFF_mm_mmap_sem 0x00000028 #define ASIZ_mm_mmap_sem 0x00000010 -#define AOFF_mm_context 0x00000030 +#define AOFF_mm_context 0x00000038 #define ASIZ_mm_context 0x00000008 -#define AOFF_mm_start_code 0x00000038 +#define AOFF_mm_start_code 0x00000040 #define ASIZ_mm_start_code 0x00000008 -#define AOFF_mm_end_code 0x00000040 +#define AOFF_mm_end_code 0x00000048 #define ASIZ_mm_end_code 0x00000008 -#define AOFF_mm_start_data 0x00000048 +#define AOFF_mm_start_data 0x00000050 #define ASIZ_mm_start_data 0x00000008 -#define AOFF_mm_end_data 0x00000050 +#define AOFF_mm_end_data 0x00000058 #define ASIZ_mm_end_data 0x00000008 -#define AOFF_mm_start_brk 0x00000058 +#define AOFF_mm_start_brk 0x00000060 #define ASIZ_mm_start_brk 0x00000008 -#define AOFF_mm_brk 0x00000060 +#define AOFF_mm_brk 0x00000068 #define ASIZ_mm_brk 0x00000008 -#define AOFF_mm_start_stack 0x00000068 +#define AOFF_mm_start_stack 0x00000070 #define ASIZ_mm_start_stack 0x00000008 -#define AOFF_mm_arg_start 0x00000070 +#define AOFF_mm_arg_start 0x00000078 #define ASIZ_mm_arg_start 0x00000008 -#define AOFF_mm_arg_end 0x00000078 +#define AOFF_mm_arg_end 0x00000080 #define ASIZ_mm_arg_end 0x00000008 -#define AOFF_mm_env_start 0x00000080 +#define AOFF_mm_env_start 0x00000088 #define ASIZ_mm_env_start 0x00000008 -#define AOFF_mm_env_end 0x00000088 +#define AOFF_mm_env_end 0x00000090 #define ASIZ_mm_env_end 0x00000008 -#define AOFF_mm_rss 0x00000090 +#define AOFF_mm_rss 0x00000098 #define ASIZ_mm_rss 0x00000008 -#define AOFF_mm_total_vm 0x00000098 +#define AOFF_mm_total_vm 0x000000a0 #define ASIZ_mm_total_vm 0x00000008 -#define AOFF_mm_locked_vm 0x000000a0 +#define AOFF_mm_locked_vm 0x000000a8 #define ASIZ_mm_locked_vm 0x00000008 -#define AOFF_mm_def_flags 0x000000a8 +#define AOFF_mm_def_flags 0x000000b0 #define ASIZ_mm_def_flags 0x00000008 -#define AOFF_mm_cpu_vm_mask 0x000000b0 +#define AOFF_mm_cpu_vm_mask 0x000000b8 #define ASIZ_mm_cpu_vm_mask 0x00000008 -#define AOFF_mm_segments 0x000000b8 +#define AOFF_mm_swap_cnt 0x000000c0 +#define ASIZ_mm_swap_cnt 0x00000008 +#define AOFF_mm_swap_address 0x000000c8 +#define ASIZ_mm_swap_address 0x00000008 +#define AOFF_mm_segments 0x000000d0 #define ASIZ_mm_segments 0x00000008 -#define ASIZ_mm 0x000000c0 +#define ASIZ_mm 0x000000d8 #define AOFF_thread_ksp 0x00000000 #define ASIZ_thread_ksp 0x00000008 #define AOFF_thread_wstate 0x00000008 @@ -284,7 +288,7 @@ #define ASIZ_thread_xfsr 0x00000038 #define ASIZ_thread 0x00000470 -#else /* __SMP__ */ +#else /* CONFIG_SMP */ #ifndef SPIN_LOCK_DEBUG @@ -304,220 +308,222 @@ #define ASIZ_task_counter 0x00000008 #define AOFF_task_priority 0x00000038 #define ASIZ_task_priority 0x00000008 -#define AOFF_task_has_cpu 0x00000040 +#define AOFF_task_avg_slice 0x00000040 +#define ASIZ_task_avg_slice 0x00000008 +#define AOFF_task_has_cpu 0x00000048 #define ASIZ_task_has_cpu 0x00000004 -#define AOFF_task_processor 0x00000044 +#define AOFF_task_processor 0x0000004c #define ASIZ_task_processor 0x00000004 -#define AOFF_task_last_processor 0x00000048 +#define AOFF_task_last_processor 0x00000050 #define ASIZ_task_last_processor 0x00000004 -#define AOFF_task_lock_depth 0x0000004c +#define AOFF_task_lock_depth 0x00000054 #define ASIZ_task_lock_depth 0x00000004 -#define AOFF_task_next_task 0x00000050 +#define AOFF_task_next_task 0x00000058 #define ASIZ_task_next_task 0x00000008 -#define AOFF_task_prev_task 0x00000058 +#define AOFF_task_prev_task 0x00000060 #define ASIZ_task_prev_task 0x00000008 -#define AOFF_task_next_run 0x00000060 +#define AOFF_task_next_run 0x00000068 #define ASIZ_task_next_run 0x00000008 -#define AOFF_task_prev_run 0x00000068 +#define AOFF_task_prev_run 0x00000070 #define ASIZ_task_prev_run 0x00000008 -#define AOFF_task_binfmt 0x00000070 +#define AOFF_task_binfmt 0x00000078 #define ASIZ_task_binfmt 0x00000008 -#define AOFF_task_exit_code 0x00000078 +#define AOFF_task_exit_code 0x00000080 #define ASIZ_task_exit_code 0x00000004 -#define AOFF_task_exit_signal 0x0000007c +#define AOFF_task_exit_signal 0x00000084 #define ASIZ_task_exit_signal 0x00000004 -#define AOFF_task_pdeath_signal 0x00000080 +#define AOFF_task_pdeath_signal 0x00000088 #define ASIZ_task_pdeath_signal 0x00000004 -#define AOFF_task_personality 0x00000088 +#define AOFF_task_personality 0x00000090 #define ASIZ_task_personality 0x00000008 -#define AOFF_task_pid 0x00000094 +#define AOFF_task_pid 0x0000009c #define ASIZ_task_pid 0x00000004 -#define AOFF_task_pgrp 0x00000098 +#define AOFF_task_pgrp 0x000000a0 #define ASIZ_task_pgrp 0x00000004 -#define AOFF_task_tty_old_pgrp 0x0000009c +#define AOFF_task_tty_old_pgrp 0x000000a4 #define ASIZ_task_tty_old_pgrp 0x00000004 -#define AOFF_task_session 0x000000a0 +#define AOFF_task_session 0x000000a8 #define ASIZ_task_session 0x00000004 -#define AOFF_task_leader 0x000000a4 +#define AOFF_task_leader 0x000000ac #define ASIZ_task_leader 0x00000004 -#define AOFF_task_p_opptr 0x000000a8 +#define AOFF_task_p_opptr 0x000000b0 #define ASIZ_task_p_opptr 0x00000008 -#define AOFF_task_p_pptr 0x000000b0 +#define AOFF_task_p_pptr 0x000000b8 #define ASIZ_task_p_pptr 0x00000008 -#define AOFF_task_p_cptr 0x000000b8 +#define AOFF_task_p_cptr 0x000000c0 #define ASIZ_task_p_cptr 0x00000008 -#define AOFF_task_p_ysptr 0x000000c0 +#define AOFF_task_p_ysptr 0x000000c8 #define ASIZ_task_p_ysptr 0x00000008 -#define AOFF_task_p_osptr 0x000000c8 +#define AOFF_task_p_osptr 0x000000d0 #define ASIZ_task_p_osptr 0x00000008 -#define AOFF_task_pidhash_next 0x000000d0 +#define AOFF_task_pidhash_next 0x000000d8 #define ASIZ_task_pidhash_next 0x00000008 -#define AOFF_task_pidhash_pprev 0x000000d8 +#define AOFF_task_pidhash_pprev 0x000000e0 #define ASIZ_task_pidhash_pprev 0x00000008 -#define AOFF_task_tarray_ptr 0x000000e0 +#define AOFF_task_tarray_ptr 0x000000e8 #define ASIZ_task_tarray_ptr 0x00000008 -#define AOFF_task_wait_chldexit 0x000000e8 +#define AOFF_task_wait_chldexit 0x000000f0 #define ASIZ_task_wait_chldexit 0x00000008 -#define AOFF_task_policy 0x000000f0 +#define AOFF_task_vfork_sem 0x000000f8 +#define ASIZ_task_vfork_sem 0x00000008 +#define AOFF_task_policy 0x00000100 #define ASIZ_task_policy 0x00000008 -#define AOFF_task_rt_priority 0x000000f8 +#define AOFF_task_rt_priority 0x00000108 #define ASIZ_task_rt_priority 0x00000008 -#define AOFF_task_it_real_value 0x00000100 +#define AOFF_task_it_real_value 0x00000110 #define ASIZ_task_it_real_value 0x00000008 -#define AOFF_task_it_prof_value 0x00000108 +#define AOFF_task_it_prof_value 0x00000118 #define ASIZ_task_it_prof_value 0x00000008 -#define AOFF_task_it_virt_value 0x00000110 +#define AOFF_task_it_virt_value 0x00000120 #define ASIZ_task_it_virt_value 0x00000008 -#define AOFF_task_it_real_incr 0x00000118 +#define AOFF_task_it_real_incr 0x00000128 #define ASIZ_task_it_real_incr 0x00000008 -#define AOFF_task_it_prof_incr 0x00000120 +#define AOFF_task_it_prof_incr 0x00000130 #define ASIZ_task_it_prof_incr 0x00000008 -#define AOFF_task_it_virt_incr 0x00000128 +#define AOFF_task_it_virt_incr 0x00000138 #define ASIZ_task_it_virt_incr 0x00000008 -#define AOFF_task_real_timer 0x00000130 +#define AOFF_task_real_timer 0x00000140 #define ASIZ_task_real_timer 0x00000028 -#define AOFF_task_times 0x00000158 +#define AOFF_task_times 0x00000168 #define ASIZ_task_times 0x00000020 -#define AOFF_task_start_time 0x00000178 +#define AOFF_task_start_time 0x00000188 #define ASIZ_task_start_time 0x00000008 -#define AOFF_task_per_cpu_utime 0x00000180 +#define AOFF_task_per_cpu_utime 0x00000190 #define ASIZ_task_per_cpu_utime 0x00000100 -#define AOFF_task_min_flt 0x00000380 +#define AOFF_task_min_flt 0x00000390 #define ASIZ_task_min_flt 0x00000008 -#define AOFF_task_maj_flt 0x00000388 +#define AOFF_task_maj_flt 0x00000398 #define ASIZ_task_maj_flt 0x00000008 -#define AOFF_task_nswap 0x00000390 +#define AOFF_task_nswap 0x000003a0 #define ASIZ_task_nswap 0x00000008 -#define AOFF_task_cmin_flt 0x00000398 +#define AOFF_task_cmin_flt 0x000003a8 #define ASIZ_task_cmin_flt 0x00000008 -#define AOFF_task_cmaj_flt 0x000003a0 +#define AOFF_task_cmaj_flt 0x000003b0 #define ASIZ_task_cmaj_flt 0x00000008 -#define AOFF_task_cnswap 0x000003a8 +#define AOFF_task_cnswap 0x000003b8 #define ASIZ_task_cnswap 0x00000008 -#define AOFF_task_swap_address 0x000003b8 -#define ASIZ_task_swap_address 0x00000008 -#define AOFF_task_old_maj_flt 0x000003c0 -#define ASIZ_task_old_maj_flt 0x00000008 -#define AOFF_task_dec_flt 0x000003c8 -#define ASIZ_task_dec_flt 0x00000008 -#define AOFF_task_swap_cnt 0x000003d0 -#define ASIZ_task_swap_cnt 0x00000008 -#define AOFF_task_uid 0x000003d8 +#define AOFF_task_uid 0x000003c4 #define ASIZ_task_uid 0x00000004 -#define AOFF_task_euid 0x000003dc +#define AOFF_task_euid 0x000003c8 #define ASIZ_task_euid 0x00000004 -#define AOFF_task_suid 0x000003e0 +#define AOFF_task_suid 0x000003cc #define ASIZ_task_suid 0x00000004 -#define AOFF_task_fsuid 0x000003e4 +#define AOFF_task_fsuid 0x000003d0 #define ASIZ_task_fsuid 0x00000004 -#define AOFF_task_gid 0x000003e8 +#define AOFF_task_gid 0x000003d4 #define ASIZ_task_gid 0x00000004 -#define AOFF_task_egid 0x000003ec +#define AOFF_task_egid 0x000003d8 #define ASIZ_task_egid 0x00000004 -#define AOFF_task_sgid 0x000003f0 +#define AOFF_task_sgid 0x000003dc #define ASIZ_task_sgid 0x00000004 -#define AOFF_task_fsgid 0x000003f4 +#define AOFF_task_fsgid 0x000003e0 #define ASIZ_task_fsgid 0x00000004 -#define AOFF_task_ngroups 0x000003f8 +#define AOFF_task_ngroups 0x000003e4 #define ASIZ_task_ngroups 0x00000004 -#define AOFF_task_groups 0x000003fc +#define AOFF_task_groups 0x000003e8 #define ASIZ_task_groups 0x00000080 -#define AOFF_task_cap_effective 0x0000047c +#define AOFF_task_cap_effective 0x00000468 #define ASIZ_task_cap_effective 0x00000004 -#define AOFF_task_cap_inheritable 0x00000480 +#define AOFF_task_cap_inheritable 0x0000046c #define ASIZ_task_cap_inheritable 0x00000004 -#define AOFF_task_cap_permitted 0x00000484 +#define AOFF_task_cap_permitted 0x00000470 #define ASIZ_task_cap_permitted 0x00000004 -#define AOFF_task_user 0x00000488 +#define AOFF_task_user 0x00000478 #define ASIZ_task_user 0x00000008 -#define AOFF_task_rlim 0x00000490 +#define AOFF_task_rlim 0x00000480 #define ASIZ_task_rlim 0x000000a0 -#define AOFF_task_used_math 0x00000530 +#define AOFF_task_used_math 0x00000520 #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_comm 0x00000532 +#define AOFF_task_comm 0x00000522 #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x00000544 +#define AOFF_task_link_count 0x00000534 #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x00000548 +#define AOFF_task_tty 0x00000538 #define ASIZ_task_tty 0x00000008 -#define AOFF_task_semundo 0x00000550 +#define AOFF_task_semundo 0x00000540 #define ASIZ_task_semundo 0x00000008 -#define AOFF_task_semsleeping 0x00000558 +#define AOFF_task_semsleeping 0x00000548 #define ASIZ_task_semsleeping 0x00000008 -#define AOFF_task_tss 0x00000560 +#define AOFF_task_tss 0x00000550 #define ASIZ_task_tss 0x00000470 -#define AOFF_task_fs 0x000009d0 +#define AOFF_task_fs 0x000009c0 #define ASIZ_task_fs 0x00000008 -#define AOFF_task_files 0x000009d8 +#define AOFF_task_files 0x000009c8 #define ASIZ_task_files 0x00000008 -#define AOFF_task_mm 0x000009e0 +#define AOFF_task_mm 0x000009d0 #define ASIZ_task_mm 0x00000008 -#define AOFF_task_sigmask_lock 0x000009e8 +#define AOFF_task_sigmask_lock 0x000009d8 #define ASIZ_task_sigmask_lock 0x00000001 -#define AOFF_task_sig 0x000009f0 +#define AOFF_task_sig 0x000009e0 #define ASIZ_task_sig 0x00000008 -#define AOFF_task_signal 0x000009f8 +#define AOFF_task_signal 0x000009e8 #define ASIZ_task_signal 0x00000008 -#define AOFF_task_blocked 0x00000a00 +#define AOFF_task_blocked 0x000009f0 #define ASIZ_task_blocked 0x00000008 -#define AOFF_task_sigqueue 0x00000a08 +#define AOFF_task_sigqueue 0x000009f8 #define ASIZ_task_sigqueue 0x00000008 -#define AOFF_task_sigqueue_tail 0x00000a10 +#define AOFF_task_sigqueue_tail 0x00000a00 #define ASIZ_task_sigqueue_tail 0x00000008 -#define AOFF_task_sas_ss_sp 0x00000a18 +#define AOFF_task_sas_ss_sp 0x00000a08 #define ASIZ_task_sas_ss_sp 0x00000008 -#define AOFF_task_sas_ss_size 0x00000a20 +#define AOFF_task_sas_ss_size 0x00000a10 #define ASIZ_task_sas_ss_size 0x00000008 -#define ASIZ_task 0x00000a30 +#define ASIZ_task 0x00000a20 #define AOFF_mm_mmap 0x00000000 #define ASIZ_mm_mmap 0x00000008 -#define AOFF_mm_mmap_cache 0x00000008 +#define AOFF_mm_mmap_avl 0x00000008 +#define ASIZ_mm_mmap_avl 0x00000008 +#define AOFF_mm_mmap_cache 0x00000010 #define ASIZ_mm_mmap_cache 0x00000008 -#define AOFF_mm_pgd 0x00000010 +#define AOFF_mm_pgd 0x00000018 #define ASIZ_mm_pgd 0x00000008 -#define AOFF_mm_count 0x00000018 +#define AOFF_mm_count 0x00000020 #define ASIZ_mm_count 0x00000004 -#define AOFF_mm_map_count 0x0000001c +#define AOFF_mm_map_count 0x00000024 #define ASIZ_mm_map_count 0x00000004 -#define AOFF_mm_mmap_sem 0x00000020 +#define AOFF_mm_mmap_sem 0x00000028 #define ASIZ_mm_mmap_sem 0x00000010 -#define AOFF_mm_context 0x00000030 +#define AOFF_mm_context 0x00000038 #define ASIZ_mm_context 0x00000008 -#define AOFF_mm_start_code 0x00000038 +#define AOFF_mm_start_code 0x00000040 #define ASIZ_mm_start_code 0x00000008 -#define AOFF_mm_end_code 0x00000040 +#define AOFF_mm_end_code 0x00000048 #define ASIZ_mm_end_code 0x00000008 -#define AOFF_mm_start_data 0x00000048 +#define AOFF_mm_start_data 0x00000050 #define ASIZ_mm_start_data 0x00000008 -#define AOFF_mm_end_data 0x00000050 +#define AOFF_mm_end_data 0x00000058 #define ASIZ_mm_end_data 0x00000008 -#define AOFF_mm_start_brk 0x00000058 +#define AOFF_mm_start_brk 0x00000060 #define ASIZ_mm_start_brk 0x00000008 -#define AOFF_mm_brk 0x00000060 +#define AOFF_mm_brk 0x00000068 #define ASIZ_mm_brk 0x00000008 -#define AOFF_mm_start_stack 0x00000068 +#define AOFF_mm_start_stack 0x00000070 #define ASIZ_mm_start_stack 0x00000008 -#define AOFF_mm_arg_start 0x00000070 +#define AOFF_mm_arg_start 0x00000078 #define ASIZ_mm_arg_start 0x00000008 -#define AOFF_mm_arg_end 0x00000078 +#define AOFF_mm_arg_end 0x00000080 #define ASIZ_mm_arg_end 0x00000008 -#define AOFF_mm_env_start 0x00000080 +#define AOFF_mm_env_start 0x00000088 #define ASIZ_mm_env_start 0x00000008 -#define AOFF_mm_env_end 0x00000088 +#define AOFF_mm_env_end 0x00000090 #define ASIZ_mm_env_end 0x00000008 -#define AOFF_mm_rss 0x00000090 +#define AOFF_mm_rss 0x00000098 #define ASIZ_mm_rss 0x00000008 -#define AOFF_mm_total_vm 0x00000098 +#define AOFF_mm_total_vm 0x000000a0 #define ASIZ_mm_total_vm 0x00000008 -#define AOFF_mm_locked_vm 0x000000a0 +#define AOFF_mm_locked_vm 0x000000a8 #define ASIZ_mm_locked_vm 0x00000008 -#define AOFF_mm_def_flags 0x000000a8 +#define AOFF_mm_def_flags 0x000000b0 #define ASIZ_mm_def_flags 0x00000008 -#define AOFF_mm_cpu_vm_mask 0x000000b0 +#define AOFF_mm_cpu_vm_mask 0x000000b8 #define ASIZ_mm_cpu_vm_mask 0x00000008 -#define AOFF_mm_segments 0x000000b8 +#define AOFF_mm_swap_cnt 0x000000c0 +#define ASIZ_mm_swap_cnt 0x00000008 +#define AOFF_mm_swap_address 0x000000c8 +#define ASIZ_mm_swap_address 0x00000008 +#define AOFF_mm_segments 0x000000d0 #define ASIZ_mm_segments 0x00000008 -#define ASIZ_mm 0x000000c0 +#define ASIZ_mm 0x000000d8 #define AOFF_thread_ksp 0x00000000 #define ASIZ_thread_ksp 0x00000008 #define AOFF_thread_wstate 0x00000008 @@ -586,220 +592,222 @@ #define ASIZ_task_counter 0x00000008 #define AOFF_task_priority 0x00000038 #define ASIZ_task_priority 0x00000008 -#define AOFF_task_has_cpu 0x00000040 +#define AOFF_task_avg_slice 0x00000040 +#define ASIZ_task_avg_slice 0x00000008 +#define AOFF_task_has_cpu 0x00000048 #define ASIZ_task_has_cpu 0x00000004 -#define AOFF_task_processor 0x00000044 +#define AOFF_task_processor 0x0000004c #define ASIZ_task_processor 0x00000004 -#define AOFF_task_last_processor 0x00000048 +#define AOFF_task_last_processor 0x00000050 #define ASIZ_task_last_processor 0x00000004 -#define AOFF_task_lock_depth 0x0000004c +#define AOFF_task_lock_depth 0x00000054 #define ASIZ_task_lock_depth 0x00000004 -#define AOFF_task_next_task 0x00000050 +#define AOFF_task_next_task 0x00000058 #define ASIZ_task_next_task 0x00000008 -#define AOFF_task_prev_task 0x00000058 +#define AOFF_task_prev_task 0x00000060 #define ASIZ_task_prev_task 0x00000008 -#define AOFF_task_next_run 0x00000060 +#define AOFF_task_next_run 0x00000068 #define ASIZ_task_next_run 0x00000008 -#define AOFF_task_prev_run 0x00000068 +#define AOFF_task_prev_run 0x00000070 #define ASIZ_task_prev_run 0x00000008 -#define AOFF_task_binfmt 0x00000070 +#define AOFF_task_binfmt 0x00000078 #define ASIZ_task_binfmt 0x00000008 -#define AOFF_task_exit_code 0x00000078 +#define AOFF_task_exit_code 0x00000080 #define ASIZ_task_exit_code 0x00000004 -#define AOFF_task_exit_signal 0x0000007c +#define AOFF_task_exit_signal 0x00000084 #define ASIZ_task_exit_signal 0x00000004 -#define AOFF_task_pdeath_signal 0x00000080 +#define AOFF_task_pdeath_signal 0x00000088 #define ASIZ_task_pdeath_signal 0x00000004 -#define AOFF_task_personality 0x00000088 +#define AOFF_task_personality 0x00000090 #define ASIZ_task_personality 0x00000008 -#define AOFF_task_pid 0x00000094 +#define AOFF_task_pid 0x0000009c #define ASIZ_task_pid 0x00000004 -#define AOFF_task_pgrp 0x00000098 +#define AOFF_task_pgrp 0x000000a0 #define ASIZ_task_pgrp 0x00000004 -#define AOFF_task_tty_old_pgrp 0x0000009c +#define AOFF_task_tty_old_pgrp 0x000000a4 #define ASIZ_task_tty_old_pgrp 0x00000004 -#define AOFF_task_session 0x000000a0 +#define AOFF_task_session 0x000000a8 #define ASIZ_task_session 0x00000004 -#define AOFF_task_leader 0x000000a4 +#define AOFF_task_leader 0x000000ac #define ASIZ_task_leader 0x00000004 -#define AOFF_task_p_opptr 0x000000a8 +#define AOFF_task_p_opptr 0x000000b0 #define ASIZ_task_p_opptr 0x00000008 -#define AOFF_task_p_pptr 0x000000b0 +#define AOFF_task_p_pptr 0x000000b8 #define ASIZ_task_p_pptr 0x00000008 -#define AOFF_task_p_cptr 0x000000b8 +#define AOFF_task_p_cptr 0x000000c0 #define ASIZ_task_p_cptr 0x00000008 -#define AOFF_task_p_ysptr 0x000000c0 +#define AOFF_task_p_ysptr 0x000000c8 #define ASIZ_task_p_ysptr 0x00000008 -#define AOFF_task_p_osptr 0x000000c8 +#define AOFF_task_p_osptr 0x000000d0 #define ASIZ_task_p_osptr 0x00000008 -#define AOFF_task_pidhash_next 0x000000d0 +#define AOFF_task_pidhash_next 0x000000d8 #define ASIZ_task_pidhash_next 0x00000008 -#define AOFF_task_pidhash_pprev 0x000000d8 +#define AOFF_task_pidhash_pprev 0x000000e0 #define ASIZ_task_pidhash_pprev 0x00000008 -#define AOFF_task_tarray_ptr 0x000000e0 +#define AOFF_task_tarray_ptr 0x000000e8 #define ASIZ_task_tarray_ptr 0x00000008 -#define AOFF_task_wait_chldexit 0x000000e8 +#define AOFF_task_wait_chldexit 0x000000f0 #define ASIZ_task_wait_chldexit 0x00000008 -#define AOFF_task_policy 0x000000f0 +#define AOFF_task_vfork_sem 0x000000f8 +#define ASIZ_task_vfork_sem 0x00000008 +#define AOFF_task_policy 0x00000100 #define ASIZ_task_policy 0x00000008 -#define AOFF_task_rt_priority 0x000000f8 +#define AOFF_task_rt_priority 0x00000108 #define ASIZ_task_rt_priority 0x00000008 -#define AOFF_task_it_real_value 0x00000100 +#define AOFF_task_it_real_value 0x00000110 #define ASIZ_task_it_real_value 0x00000008 -#define AOFF_task_it_prof_value 0x00000108 +#define AOFF_task_it_prof_value 0x00000118 #define ASIZ_task_it_prof_value 0x00000008 -#define AOFF_task_it_virt_value 0x00000110 +#define AOFF_task_it_virt_value 0x00000120 #define ASIZ_task_it_virt_value 0x00000008 -#define AOFF_task_it_real_incr 0x00000118 +#define AOFF_task_it_real_incr 0x00000128 #define ASIZ_task_it_real_incr 0x00000008 -#define AOFF_task_it_prof_incr 0x00000120 +#define AOFF_task_it_prof_incr 0x00000130 #define ASIZ_task_it_prof_incr 0x00000008 -#define AOFF_task_it_virt_incr 0x00000128 +#define AOFF_task_it_virt_incr 0x00000138 #define ASIZ_task_it_virt_incr 0x00000008 -#define AOFF_task_real_timer 0x00000130 +#define AOFF_task_real_timer 0x00000140 #define ASIZ_task_real_timer 0x00000028 -#define AOFF_task_times 0x00000158 +#define AOFF_task_times 0x00000168 #define ASIZ_task_times 0x00000020 -#define AOFF_task_start_time 0x00000178 +#define AOFF_task_start_time 0x00000188 #define ASIZ_task_start_time 0x00000008 -#define AOFF_task_per_cpu_utime 0x00000180 +#define AOFF_task_per_cpu_utime 0x00000190 #define ASIZ_task_per_cpu_utime 0x00000100 -#define AOFF_task_min_flt 0x00000380 +#define AOFF_task_min_flt 0x00000390 #define ASIZ_task_min_flt 0x00000008 -#define AOFF_task_maj_flt 0x00000388 +#define AOFF_task_maj_flt 0x00000398 #define ASIZ_task_maj_flt 0x00000008 -#define AOFF_task_nswap 0x00000390 +#define AOFF_task_nswap 0x000003a0 #define ASIZ_task_nswap 0x00000008 -#define AOFF_task_cmin_flt 0x00000398 +#define AOFF_task_cmin_flt 0x000003a8 #define ASIZ_task_cmin_flt 0x00000008 -#define AOFF_task_cmaj_flt 0x000003a0 +#define AOFF_task_cmaj_flt 0x000003b0 #define ASIZ_task_cmaj_flt 0x00000008 -#define AOFF_task_cnswap 0x000003a8 +#define AOFF_task_cnswap 0x000003b8 #define ASIZ_task_cnswap 0x00000008 -#define AOFF_task_swap_address 0x000003b8 -#define ASIZ_task_swap_address 0x00000008 -#define AOFF_task_old_maj_flt 0x000003c0 -#define ASIZ_task_old_maj_flt 0x00000008 -#define AOFF_task_dec_flt 0x000003c8 -#define ASIZ_task_dec_flt 0x00000008 -#define AOFF_task_swap_cnt 0x000003d0 -#define ASIZ_task_swap_cnt 0x00000008 -#define AOFF_task_uid 0x000003d8 +#define AOFF_task_uid 0x000003c4 #define ASIZ_task_uid 0x00000004 -#define AOFF_task_euid 0x000003dc +#define AOFF_task_euid 0x000003c8 #define ASIZ_task_euid 0x00000004 -#define AOFF_task_suid 0x000003e0 +#define AOFF_task_suid 0x000003cc #define ASIZ_task_suid 0x00000004 -#define AOFF_task_fsuid 0x000003e4 +#define AOFF_task_fsuid 0x000003d0 #define ASIZ_task_fsuid 0x00000004 -#define AOFF_task_gid 0x000003e8 +#define AOFF_task_gid 0x000003d4 #define ASIZ_task_gid 0x00000004 -#define AOFF_task_egid 0x000003ec +#define AOFF_task_egid 0x000003d8 #define ASIZ_task_egid 0x00000004 -#define AOFF_task_sgid 0x000003f0 +#define AOFF_task_sgid 0x000003dc #define ASIZ_task_sgid 0x00000004 -#define AOFF_task_fsgid 0x000003f4 +#define AOFF_task_fsgid 0x000003e0 #define ASIZ_task_fsgid 0x00000004 -#define AOFF_task_ngroups 0x000003f8 +#define AOFF_task_ngroups 0x000003e4 #define ASIZ_task_ngroups 0x00000004 -#define AOFF_task_groups 0x000003fc +#define AOFF_task_groups 0x000003e8 #define ASIZ_task_groups 0x00000080 -#define AOFF_task_cap_effective 0x0000047c +#define AOFF_task_cap_effective 0x00000468 #define ASIZ_task_cap_effective 0x00000004 -#define AOFF_task_cap_inheritable 0x00000480 +#define AOFF_task_cap_inheritable 0x0000046c #define ASIZ_task_cap_inheritable 0x00000004 -#define AOFF_task_cap_permitted 0x00000484 +#define AOFF_task_cap_permitted 0x00000470 #define ASIZ_task_cap_permitted 0x00000004 -#define AOFF_task_user 0x00000488 +#define AOFF_task_user 0x00000478 #define ASIZ_task_user 0x00000008 -#define AOFF_task_rlim 0x00000490 +#define AOFF_task_rlim 0x00000480 #define ASIZ_task_rlim 0x000000a0 -#define AOFF_task_used_math 0x00000530 +#define AOFF_task_used_math 0x00000520 #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_comm 0x00000532 +#define AOFF_task_comm 0x00000522 #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x00000544 +#define AOFF_task_link_count 0x00000534 #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x00000548 +#define AOFF_task_tty 0x00000538 #define ASIZ_task_tty 0x00000008 -#define AOFF_task_semundo 0x00000550 +#define AOFF_task_semundo 0x00000540 #define ASIZ_task_semundo 0x00000008 -#define AOFF_task_semsleeping 0x00000558 +#define AOFF_task_semsleeping 0x00000548 #define ASIZ_task_semsleeping 0x00000008 -#define AOFF_task_tss 0x00000560 +#define AOFF_task_tss 0x00000550 #define ASIZ_task_tss 0x00000470 -#define AOFF_task_fs 0x000009d0 +#define AOFF_task_fs 0x000009c0 #define ASIZ_task_fs 0x00000008 -#define AOFF_task_files 0x000009d8 +#define AOFF_task_files 0x000009c8 #define ASIZ_task_files 0x00000008 -#define AOFF_task_mm 0x000009e0 +#define AOFF_task_mm 0x000009d0 #define ASIZ_task_mm 0x00000008 -#define AOFF_task_sigmask_lock 0x000009e8 +#define AOFF_task_sigmask_lock 0x000009d8 #define ASIZ_task_sigmask_lock 0x0000000c -#define AOFF_task_sig 0x000009f8 +#define AOFF_task_sig 0x000009e8 #define ASIZ_task_sig 0x00000008 -#define AOFF_task_signal 0x00000a00 +#define AOFF_task_signal 0x000009f0 #define ASIZ_task_signal 0x00000008 -#define AOFF_task_blocked 0x00000a08 +#define AOFF_task_blocked 0x000009f8 #define ASIZ_task_blocked 0x00000008 -#define AOFF_task_sigqueue 0x00000a10 +#define AOFF_task_sigqueue 0x00000a00 #define ASIZ_task_sigqueue 0x00000008 -#define AOFF_task_sigqueue_tail 0x00000a18 +#define AOFF_task_sigqueue_tail 0x00000a08 #define ASIZ_task_sigqueue_tail 0x00000008 -#define AOFF_task_sas_ss_sp 0x00000a20 +#define AOFF_task_sas_ss_sp 0x00000a10 #define ASIZ_task_sas_ss_sp 0x00000008 -#define AOFF_task_sas_ss_size 0x00000a28 +#define AOFF_task_sas_ss_size 0x00000a18 #define ASIZ_task_sas_ss_size 0x00000008 -#define ASIZ_task 0x00000a30 +#define ASIZ_task 0x00000a20 #define AOFF_mm_mmap 0x00000000 #define ASIZ_mm_mmap 0x00000008 -#define AOFF_mm_mmap_cache 0x00000008 +#define AOFF_mm_mmap_avl 0x00000008 +#define ASIZ_mm_mmap_avl 0x00000008 +#define AOFF_mm_mmap_cache 0x00000010 #define ASIZ_mm_mmap_cache 0x00000008 -#define AOFF_mm_pgd 0x00000010 +#define AOFF_mm_pgd 0x00000018 #define ASIZ_mm_pgd 0x00000008 -#define AOFF_mm_count 0x00000018 +#define AOFF_mm_count 0x00000020 #define ASIZ_mm_count 0x00000004 -#define AOFF_mm_map_count 0x0000001c +#define AOFF_mm_map_count 0x00000024 #define ASIZ_mm_map_count 0x00000004 -#define AOFF_mm_mmap_sem 0x00000020 +#define AOFF_mm_mmap_sem 0x00000028 #define ASIZ_mm_mmap_sem 0x00000010 -#define AOFF_mm_context 0x00000030 +#define AOFF_mm_context 0x00000038 #define ASIZ_mm_context 0x00000008 -#define AOFF_mm_start_code 0x00000038 +#define AOFF_mm_start_code 0x00000040 #define ASIZ_mm_start_code 0x00000008 -#define AOFF_mm_end_code 0x00000040 +#define AOFF_mm_end_code 0x00000048 #define ASIZ_mm_end_code 0x00000008 -#define AOFF_mm_start_data 0x00000048 +#define AOFF_mm_start_data 0x00000050 #define ASIZ_mm_start_data 0x00000008 -#define AOFF_mm_end_data 0x00000050 +#define AOFF_mm_end_data 0x00000058 #define ASIZ_mm_end_data 0x00000008 -#define AOFF_mm_start_brk 0x00000058 +#define AOFF_mm_start_brk 0x00000060 #define ASIZ_mm_start_brk 0x00000008 -#define AOFF_mm_brk 0x00000060 +#define AOFF_mm_brk 0x00000068 #define ASIZ_mm_brk 0x00000008 -#define AOFF_mm_start_stack 0x00000068 +#define AOFF_mm_start_stack 0x00000070 #define ASIZ_mm_start_stack 0x00000008 -#define AOFF_mm_arg_start 0x00000070 +#define AOFF_mm_arg_start 0x00000078 #define ASIZ_mm_arg_start 0x00000008 -#define AOFF_mm_arg_end 0x00000078 +#define AOFF_mm_arg_end 0x00000080 #define ASIZ_mm_arg_end 0x00000008 -#define AOFF_mm_env_start 0x00000080 +#define AOFF_mm_env_start 0x00000088 #define ASIZ_mm_env_start 0x00000008 -#define AOFF_mm_env_end 0x00000088 +#define AOFF_mm_env_end 0x00000090 #define ASIZ_mm_env_end 0x00000008 -#define AOFF_mm_rss 0x00000090 +#define AOFF_mm_rss 0x00000098 #define ASIZ_mm_rss 0x00000008 -#define AOFF_mm_total_vm 0x00000098 +#define AOFF_mm_total_vm 0x000000a0 #define ASIZ_mm_total_vm 0x00000008 -#define AOFF_mm_locked_vm 0x000000a0 +#define AOFF_mm_locked_vm 0x000000a8 #define ASIZ_mm_locked_vm 0x00000008 -#define AOFF_mm_def_flags 0x000000a8 +#define AOFF_mm_def_flags 0x000000b0 #define ASIZ_mm_def_flags 0x00000008 -#define AOFF_mm_cpu_vm_mask 0x000000b0 +#define AOFF_mm_cpu_vm_mask 0x000000b8 #define ASIZ_mm_cpu_vm_mask 0x00000008 -#define AOFF_mm_segments 0x000000b8 +#define AOFF_mm_swap_cnt 0x000000c0 +#define ASIZ_mm_swap_cnt 0x00000008 +#define AOFF_mm_swap_address 0x000000c8 +#define ASIZ_mm_swap_address 0x00000008 +#define AOFF_mm_segments 0x000000d0 #define ASIZ_mm_segments 0x00000008 -#define ASIZ_mm 0x000000c0 +#define ASIZ_mm 0x000000d8 #define AOFF_thread_ksp 0x00000000 #define ASIZ_thread_ksp 0x00000008 #define AOFF_thread_wstate 0x00000008 @@ -851,6 +859,6 @@ #define ASIZ_thread 0x00000470 #endif /* SPIN_LOCK_DEBUG */ -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif /* __ASM_OFFSETS_H__ */ diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index d355b1ed4..27820f265 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h @@ -1,4 +1,4 @@ -/* $Id: bitops.h,v 1.25 1998/07/26 03:05:51 davem Exp $ +/* $Id: bitops.h,v 1.26 1999/01/07 14:14:15 jj Exp $ * bitops.h: Bit string operations on the V9. * * Copyright 1996, 1997 David S. Miller (davem@caip.rutgers.edu) @@ -14,8 +14,8 @@ * primitives used are not privileged. */ -/* Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0' - * is in the highest of the four bytes and bit '31' is the high bit +/* Set bit 'nr' in 64-bit quantity at address 'addr' where bit '0' + * is in the highest of the eight bytes and bit '63' is the high bit * within the first byte. Sparc is BIG-Endian. Unless noted otherwise * all bit-ops return 0 if bit was previously clear and != 0 otherwise. */ diff --git a/include/asm-sparc64/cache.h b/include/asm-sparc64/cache.h index 8c2ec6bc6..bc40fe99d 100644 --- a/include/asm-sparc64/cache.h +++ b/include/asm-sparc64/cache.h @@ -9,4 +9,6 @@ #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) +#define SMP_CACHE_BYTES 64 /* L2 cache line size. */ + #endif diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h index e6175ab4f..a0980bc30 100644 --- a/include/asm-sparc64/dma.h +++ b/include/asm-sparc64/dma.h @@ -1,4 +1,4 @@ -/* $Id: dma.h,v 1.10 1998/10/27 23:28:50 davem Exp $ +/* $Id: dma.h,v 1.13 1998/12/16 04:33:55 davem Exp $ * include/asm-sparc64/dma.h * * Copyright 1996 (C) David S. Miller (davem@caip.rutgers.edu) @@ -30,10 +30,13 @@ extern spinlock_t dma_spin_lock; * things can compile. */ #define MAX_DMA_CHANNELS 8 -#define MAX_DMA_ADDRESS ((0xf0000000) + PAGE_OFFSET) #define DMA_MODE_READ 1 #define DMA_MODE_WRITE 2 +/* This is actually used. */ +extern unsigned long phys_base; +#define MAX_DMA_ADDRESS (phys_base + (0xfe000000UL) + PAGE_OFFSET) + /* Useful constants */ #define SIZE_16MB (16*1024*1024) #define SIZE_64K (64*1024) @@ -115,13 +118,14 @@ extern void dvma_init(struct linux_sbus *); #define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */ #define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */ #define DMA_TERM_CNTR 0x00004000 /* Terminal counter */ +#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */ #define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */ #define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */ #define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */ #define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */ #define DMA_E_BURST8 0x00040000 /* ENET: SBUS r/w burst size */ #define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */ -#define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */ +#define DMA_BRST64 0x000c0000 /* SCSI: 64byte bursts (HME on UltraSparc only) */ #define DMA_BRST32 0x00040000 /* SCSI: 32byte bursts */ #define DMA_BRST16 0x00000000 /* SCSI: 16byte bursts */ #define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */ @@ -135,6 +139,7 @@ extern void dvma_init(struct linux_sbus *); #define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */ #define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */ #define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */ +#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */ /* Values describing the burst-size property from the PROM */ #define DMA_BURST1 0x01 diff --git a/include/asm-sparc64/ethtool.h b/include/asm-sparc64/ethtool.h new file mode 100644 index 000000000..b070ea1a4 --- /dev/null +++ b/include/asm-sparc64/ethtool.h @@ -0,0 +1,79 @@ +/* $Id: ethtool.h,v 1.1 1998/12/19 15:09:40 davem Exp $ + * ethtool.h: Defines for SparcLinux ethtool. + * + * Copyright (C) 1998 David S. Miller (davem@dm.cobaltmicro.com) + */ + +#ifndef _SPARC64_ETHTOOL_H +#define _SPARC64_ETHTOOL_H + +/* We do things like this so it does not matter what kernel + * headers you have on your system etc. + */ +#undef SIOCETHTOOL +#define SIOCETHTOOL (SIOCDEVPRIVATE + 0x0f) + +/* This should work for both 32 and 64 bit userland. */ +struct ethtool_cmd { + u32 cmd; + u32 supported; + u16 speed; + u8 duplex; + u8 port; + u8 phy_address; + u8 transceiver; + u8 autoneg; +}; + +/* CMDs currently supported */ +#define SPARC_ETH_GSET 0x00000001 /* Get settings, non-privileged. */ +#define SPARC_ETH_SSET 0x00000002 /* Set settings, privileged. */ + +/* Indicates what features are supported by the interface. */ +#define SUPPORTED_10baseT_Half 0x00000001 +#define SUPPORTED_10baseT_Full 0x00000002 +#define SUPPORTED_100baseT_Half 0x00000004 +#define SUPPORTED_100baseT_Full 0x00000008 +#define SUPPORTED_1000baseT_Half 0x00000010 +#define SUPPORTED_1000baseT_Full 0x00000020 +#define SUPPORTED_Autoneg 0x00000040 +#define SUPPORTED_TP 0x00000080 +#define SUPPORTED_AUI 0x00000100 +#define SUPPORTED_MII 0x00000200 +#define SUPPORTED_FIBRE 0x00000400 + +/* The following are all involved in forcing a particular link + * mode for the device for setting things. When getting the + * devices settings, these indicate the current mode and whether + * it was foced up into this mode or autonegotiated. + */ + +/* The forced speec, 10Mb, 100Mb, gigabit. */ +#define SPEED_10 10 +#define SPEED_100 100 +#define SPEED_1000 1000 + +/* Duplex, half or full. */ +#define DUPLEX_HALF 0x00 +#define DUPLEX_FULL 0x01 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 + +/* Which tranceiver to use. */ +#define XCVR_INTERNAL 0x00 +#define XCVR_EXTERNAL 0x01 +#define XCVR_DUMMY1 0x02 +#define XCVR_DUMMY2 0x03 +#define XCVR_DUMMY3 0x04 + +/* Enable or disable autonegotiation. If this is set to enable, + * the forced link modes above are completely ignored. + */ +#define AUTONEG_DISABLE 0x00 +#define AUTONEG_ENABLE 0x01 + +#endif /* _SPARC64_ETHTOOL_H */ diff --git a/include/asm-sparc64/fhc.h b/include/asm-sparc64/fhc.h index 487a40389..d93fdd733 100644 --- a/include/asm-sparc64/fhc.h +++ b/include/asm-sparc64/fhc.h @@ -1,4 +1,4 @@ -/* $Id: fhc.h,v 1.1 1997/08/08 04:26:40 davem Exp $ +/* $Id: fhc.h,v 1.4 1998/12/14 12:18:20 davem Exp $ * fhc.h: Structures for central/fhc pseudo driver on Sunfire/Starfire/Wildfire. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -7,13 +7,42 @@ #ifndef _SPARC64_FHC_H #define _SPARC64_FHC_H +#include <linux/timer.h> + #include <asm/firehose.h> #include <asm/oplib.h> struct linux_fhc; +struct clock_board_regs { + u8 control; + u8 _unused1[0x10 - 0x01]; + u8 stat1; + u8 _unused2[0x10 - 0x01]; + u8 stat2; + u8 _unused3[0x10 - 0x01]; + u8 pwr_stat; + u8 _unused4[0x10 - 0x01]; + u8 pwr_presence; + u8 _unused5[0x10 - 0x01]; + u8 temperature; + u8 _unused6[0x10 - 0x01]; + u8 irq_diag; + u8 _unused7[0x10 - 0x01]; + u8 pwr_stat2; + u8 _unused8[0x10 - 0x01]; +}; + +#define CLOCK_CTRL_LLED 0x04 /* Left LED, 0 == on */ +#define CLOCK_CTRL_MLED 0x02 /* Mid LED, 1 == on */ +#define CLOCK_CTRL_RLED 0x01 /* RIght LED, 1 == on */ + struct linux_central { struct linux_fhc *child; + volatile u8 *cfreg; + struct clock_board_regs *clkregs; + volatile u8 *clkver; + int slots; int prom_node; char prom_name[64]; @@ -25,6 +54,8 @@ struct linux_fhc { struct linux_fhc *next; struct linux_central *parent; /* NULL if not central FHC */ struct fhc_regs fhc_regs; + int board; + int jtag_master; int prom_node; char prom_name[64]; diff --git a/include/asm-sparc64/firehose.h b/include/asm-sparc64/firehose.h index de403e98c..d6031c927 100644 --- a/include/asm-sparc64/firehose.h +++ b/include/asm-sparc64/firehose.h @@ -1,4 +1,4 @@ -/* $Id: firehose.h,v 1.3 1998/06/10 07:28:43 davem Exp $ +/* $Id: firehose.h,v 1.4 1998/12/02 10:16:47 davem Exp $ * firehose.h: Defines for the Fire Hose Controller (FHC) found * on Sunfire/Starfire/Wildfire systems. * @@ -10,8 +10,6 @@ #include <linux/types.h> -/* XXX I have not fully verified the register sizes in this file yet... -DaveM */ - /* Fire Hose Controller Internal Registers */ struct fhc_internal_regs { /*0x0000*/ u32 fhc_id; /* FHC ID Register */ @@ -33,31 +31,31 @@ struct fhc_internal_regs { * for the FHC, thus we have the following few structs... */ struct fhc_ign_reg { -/*0x2000*/ u64 fhc_ign; /* FHC Interrupt Group Number */ +/*0x2000*/ u32 fhc_ign; /* FHC Interrupt Group Number */ }; struct fhc_fanfail_regs { -/*0x4000*/ u32 _pad0, fhc_ff_imap; /* FHC FanFail Interrupt Map */ - u64 _pad1; -/*0x4010*/ u32 _pad2, fhc_ff_iclr; /* FHC FanFail Interrupt Clear */ +/*0x4000*/ u32 fhc_ff_imap; /* FHC FanFail Interrupt Map */ + u32 _pad[3]; +/*0x4010*/ u32 fhc_ff_iclr; /* FHC FanFail Interrupt Clear */ }; struct fhc_system_regs { -/*0x6000*/ u32 _pad0, fhc_sys_imap; /* FHC System Interrupt Map */ - u64 _pad1; -/*0x6010*/ u32 _pad2, fhc_sys_iclr; /* FHC System Interrupt Clear */ +/*0x6000*/ u32 fhc_sys_imap; /* FHC System Interrupt Map */ + u32 _pad[3]; +/*0x6010*/ u32 fhc_sys_iclr; /* FHC System Interrupt Clear */ }; struct fhc_uart_regs { -/*0x8000*/ u32 _pad0, fhc_uart_imap; /* FHC UART Interrupt Map */ - u64 _pad1; -/*0x8010*/ u32 _pad2, fhc_uart_iclr; /* FHC UART Interrupt Clear */ +/*0x8000*/ u32 fhc_uart_imap; /* FHC UART Interrupt Map */ + u32 _pad[3]; +/*0x8010*/ u32 fhc_uart_iclr; /* FHC UART Interrupt Clear */ }; struct fhc_tod_regs { -/*0xa000*/ u32 _pad0, fhc_tod_imap; /* FHC TOD Interrupt Map */ - u64 _pad1; -/*0xa010*/ u32 _pad2, fhc_tod_iclr; /* FHC TOD Interrupt Clear */ +/*0xa000*/ u32 fhc_tod_imap; /* FHC TOD Interrupt Map */ + u32 _pad1[3]; +/*0xa010*/ u32 fhc_tod_iclr; /* FHC TOD Interrupt Clear */ }; /* All of the above. */ @@ -105,15 +103,19 @@ struct fhc_regs { #define FHC_RCS_FENAB 0x01000000 /* Fatal errors elicit system reset */ /* FHC Board Status Register */ -#define FHC_BSD_DA64 0x00040000 /* Port A: 0=128bit 1=64bit data path */ -#define FHC_BSD_DB64 0x00020000 /* Port B: 0=128bit 1=64bit data path */ -#define FHC_BSD_BID 0x0001e000 /* Board ID */ -#define FHC_BSD_SA 0x00001c00 /* Port A UPA Speed (from the pins) */ -#define FHC_BSD_SB 0x00000380 /* Port B UPA Speed (from the pins) */ -#define FHC_BSD_NDIAG 0x00000040 /* Not in Diag Mode */ -#define FHC_BSD_NTBED 0x00000020 /* Not in TestBED Mode */ -#define FHC_BSD_NIA 0x0000001c /* Jumper, bit 18 in PROM space */ -#define FHC_BSD_SI 0x00000001 /* Spare input pin value */ +#define FHC_BSR_DA64 0x00040000 /* Port A: 0=128bit 1=64bit data path */ +#define FHC_BSR_DB64 0x00020000 /* Port B: 0=128bit 1=64bit data path */ +#define FHC_BSR_BID 0x0001e000 /* Board ID */ +#define FHC_BSR_SA 0x00001c00 /* Port A UPA Speed (from the pins) */ +#define FHC_BSR_SB 0x00000380 /* Port B UPA Speed (from the pins) */ +#define FHC_BSR_NDIAG 0x00000040 /* Not in Diag Mode */ +#define FHC_BSR_NTBED 0x00000020 /* Not in TestBED Mode */ +#define FHC_BSR_NIA 0x0000001c /* Jumper, bit 18 in PROM space */ +#define FHC_BSR_SI 0x00000001 /* Spare input pin value */ + +/* FHC JTAG Control Register */ +#define FHC_JTAG_CTRL_MENAB 0x80000000 /* Indicates this is JTAG Master */ +#define FHC_JTAG_CTRL_MNONE 0x40000000 /* Indicates no JTAG Master present */ /* FHC then has an Interrupt Group Number register, essentially this is a 32-bit * register with the low 5 bits specifying the IGN of this FHC for interrupt diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h index 33550d4e1..80b58af20 100644 --- a/include/asm-sparc64/floppy.h +++ b/include/asm-sparc64/floppy.h @@ -1,4 +1,4 @@ -/* $Id: floppy.h,v 1.16 1998/10/06 20:32:15 ecd Exp $ +/* $Id: floppy.h,v 1.18 1999/03/21 10:51:38 davem Exp $ * asm-sparc64/floppy.h: Sparc specific parts of the Floppy driver. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -127,6 +127,7 @@ static int FDC2 = -1; static unsigned char sun_82077_fd_inb(unsigned long port) { + udelay(5); switch(port & 7) { default: printk("floppy: Asked to read unknown port %lx\n", port); @@ -144,6 +145,7 @@ static unsigned char sun_82077_fd_inb(unsigned long port) static void sun_82077_fd_outb(unsigned char value, unsigned long port) { + udelay(5); switch(port & 7) { default: printk("floppy: Asked to write to unknown port %lx\n", port); @@ -715,7 +717,7 @@ __initfunc(static unsigned long sun_floppy_init(void)) sun_fdops.fd_inb = sun_82077_fd_inb; sun_fdops.fd_outb = sun_82077_fd_outb; - use_virtual_dma = 1; + can_use_virtual_dma = use_virtual_dma = 1; sun_fdops.fd_enable_dma = sun_fd_enable_dma; sun_fdops.fd_disable_dma = sun_fd_disable_dma; sun_fdops.fd_set_dma_mode = sun_fd_set_dma_mode; diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h index 503acdb27..191b95cb2 100644 --- a/include/asm-sparc64/ide.h +++ b/include/asm-sparc64/ide.h @@ -1,4 +1,4 @@ -/* $Id: ide.h,v 1.11 1998/08/12 22:19:37 ecd Exp $ +/* $Id: ide.h,v 1.12 1999/04/17 14:25:29 davem Exp $ * ide.h: Ultra/PCI specific IDE glue. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -123,7 +123,7 @@ static __inline__ void ide_insw(unsigned long port, unsigned long count) { volatile unsigned short *data_port; - unsigned long end = (unsigned long)dst + count; + unsigned long end = (unsigned long)dst + (count << 1); u16 *ps = dst; u32 *pi; @@ -154,7 +154,7 @@ static __inline__ void ide_outsw(unsigned long port, unsigned long count) { volatile unsigned short *data_port; - unsigned long end = (unsigned long)src + count; + unsigned long end = (unsigned long)src + (count << 1); const u16 *ps = src; const u32 *pi; diff --git a/include/asm-sparc64/init.h b/include/asm-sparc64/init.h index 8076e88f7..4aec3125a 100644 --- a/include/asm-sparc64/init.h +++ b/include/asm-sparc64/init.h @@ -11,4 +11,6 @@ #define __FINIT .previous #define __INITDATA .section ".data.init",#alloc,#write +#define __cacheline_aligned __attribute__ ((aligned (64))) + #endif diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h index f52844fe4..d74f3fc85 100644 --- a/include/asm-sparc64/iommu.h +++ b/include/asm-sparc64/iommu.h @@ -38,22 +38,17 @@ #define IOPTE_VALID 0x8000000000000000 /* IOPTE is valid */ #define IOPTE_64K 0x2000000000000000 /* IOPTE is for 64k page */ #define IOPTE_STBUF 0x1000000000000000 /* DVMA can use streaming buffer */ -#define IOPTE_INTRA 0x0800000000000000 /* XXX what does this thing do? */ +#define IOPTE_INTRA 0x0800000000000000 /* SBUS slot-->slot direct transfer */ #define IOPTE_PAGE 0x000001ffffffe000 /* Physical page number (PA[40:13]) */ #define IOPTE_CACHE 0x0000000000000010 /* Cached (in UPA E-cache) */ #define IOPTE_WRITE 0x0000000000000002 /* Writeable */ struct iommu_struct { struct sysio_regs *sysio_regs; - unsigned int *sbuf_flushflag_va; - unsigned long sbuf_flushflag_pa; - spinlock_t iommu_lock; - iopte_t *page_table; - - /* For convenience */ - unsigned long start; /* First managed virtual address */ - unsigned long end; /* Last managed virtual address */ + volatile unsigned int flushflag; + unsigned int strbuf_enabled; + spinlock_t iommu_lock; }; #endif /* !(_SPARC_IOMMU_H) */ diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index b9a900406..bad6a838a 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h @@ -1,4 +1,4 @@ -/* $Id: irq.h,v 1.10 1998/05/29 06:00:39 ecd Exp $ +/* $Id: irq.h,v 1.14 1998/12/19 11:05:41 davem Exp $ * irq.h: IRQ registers on the 64-bit Sparc. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -15,23 +15,71 @@ struct devid_cookie { int dummy; }; -/* You should not mess with this directly. That's the job of irq.c. */ +/* You should not mess with this directly. That's the job of irq.c. + * + * If you make changes here, please update hand coded assembler of + * SBUS/floppy interrupt handler in entry.S -DaveM + * + * This is currently one DCACHE line, two buckets per L2 cache + * line. Keep this in mind please. + */ struct ino_bucket { - unsigned short ino; - short imap_off; - unsigned short pil; - unsigned short flags; - unsigned int *iclr; + /* Next handler in per-CPU PIL worklist. We know that + * bucket pointers have the high 32-bits clear, so to + * save space we only store the bits we need. + */ +/*0x00*/unsigned int irq_chain; + + /* PIL to schedule this IVEC at. */ +/*0x04*/unsigned char pil; + + /* If an IVEC arrives while irq_info is NULL, we + * set this to notify request_irq() about the event. + */ +/*0x05*/unsigned char pending; + + /* Miscellaneous flags. */ +/*0x06*/unsigned char flags; + + /* Unused right now, but we will use it for proper + * enable_irq()/disable_irq() nesting. + */ +/*0x07*/unsigned char __unused; + + /* Reference to handler for this IRQ. If this is + * non-NULL this means it is active and should be + * serviced. Else the pending member is set to one + * and later registry of the interrupt checks for + * this condition. + * + * Normally this is just an irq_action structure. + * But, on PCI, if multiple interrupt sources behind + * a bridge have multiple interrupt sources that share + * the same INO bucket, this points to an array of + * pointers to four IRQ action structures. + */ +/*0x08*/void *irq_info; + + /* Sun5 Interrupt Clear Register. */ +/*0x10*/unsigned int *iclr; + + /* Sun5 Interrupt Mapping Register. */ +/*0x18*/unsigned int *imap; + }; -#define __irq_ino(irq) ((struct ino_bucket *)(unsigned long)(irq))->ino +#define NUM_IVECS 8192 +extern struct ino_bucket ivector_table[NUM_IVECS]; + +#define __irq_ino(irq) \ + (((struct ino_bucket *)(unsigned long)(irq)) - &ivector_table[0]) #define __irq_pil(irq) ((struct ino_bucket *)(unsigned long)(irq))->pil static __inline__ char *__irq_itoa(unsigned int irq) { static char buff[16]; - sprintf(buff, "%d,%x", __irq_pil(irq), __irq_ino(irq)); + sprintf(buff, "%d,%x", __irq_pil(irq), (unsigned int)__irq_ino(irq)); return buff; } diff --git a/include/asm-sparc64/keyboard.h b/include/asm-sparc64/keyboard.h index 1bc97d597..15f24c33f 100644 --- a/include/asm-sparc64/keyboard.h +++ b/include/asm-sparc64/keyboard.h @@ -1,4 +1,4 @@ -/* $Id: keyboard.h,v 1.2 1997/09/07 15:40:49 ecd Exp $ +/* $Id: keyboard.h,v 1.3 1999/04/28 11:59:12 davem Exp $ * linux/include/asm-sparc64/keyboard.h * * Created Aug 29 1997 by Eddie C. Dost (ecd@skynet.be) @@ -18,7 +18,6 @@ extern int pcikbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pcikbd_getkeycode(unsigned int scancode); -extern int pcikbd_pretranslate(unsigned char scancode, char raw_mode); extern int pcikbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pcikbd_unexpected_up(unsigned char keycode); @@ -28,7 +27,6 @@ extern unsigned char pcikbd_sysrq_xlate[128]; #define kbd_setkeycode pcikbd_setkeycode #define kbd_getkeycode pcikbd_getkeycode -#define kbd_pretranslate pcikbd_pretranslate #define kbd_translate pcikbd_translate #define kbd_unexpected_up pcikbd_unexpected_up #define kbd_leds pcikbd_leds diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h index 7fa368638..d29cb2a35 100644 --- a/include/asm-sparc64/mmu_context.h +++ b/include/asm-sparc64/mmu_context.h @@ -1,4 +1,4 @@ -/* $Id: mmu_context.h,v 1.32 1998/10/13 14:03:52 davem Exp $ */ +/* $Id: mmu_context.h,v 1.35 1999/05/08 03:03:20 davem Exp $ */ #ifndef __SPARC64_MMU_CONTEXT_H #define __SPARC64_MMU_CONTEXT_H @@ -13,7 +13,6 @@ #ifndef __ASSEMBLY__ extern unsigned long tlb_context_cache; -extern spinlock_t scheduler_lock; extern unsigned long mmu_context_bmap[]; #define CTX_VERSION_SHIFT (PAGE_SHIFT - 3) @@ -38,11 +37,9 @@ extern void get_new_mmu_context(struct mm_struct *mm); #define destroy_context(__mm) do { \ if ((__mm)->context != NO_CONTEXT && \ atomic_read(&(__mm)->count) == 1) { \ - spin_lock(&scheduler_lock); \ if (!(((__mm)->context ^ tlb_context_cache) & CTX_VERSION_MASK))\ clear_bit((__mm)->context & ~(CTX_VERSION_MASK), \ mmu_context_bmap); \ - spin_unlock(&scheduler_lock); \ (__mm)->context = NO_CONTEXT; \ if(current->mm == (__mm)) { \ current->tss.ctx = 0; \ @@ -89,7 +86,7 @@ extern __inline__ void __get_mmu_context(struct task_struct *tsk) paddr = __pa(mm->pgd); if((tsk->tss.flags & (SPARC_FLAG_32BIT|SPARC_FLAG_KTHREAD)) == (SPARC_FLAG_32BIT)) - pgd_cache = (unsigned long) mm->pgd[0]; + pgd_cache = ((unsigned long) mm->pgd[0]) << 11UL; else pgd_cache = 0; __asm__ __volatile__(" @@ -115,13 +112,19 @@ extern __inline__ void __get_mmu_context(struct task_struct *tsk) /* * After we have set current->mm to a new value, this activates - * the context for the new mm so we see the new mappings. + * the context for the new mm so we see the new mappings. Currently, + * this is always called for 'current', if that changes put appropriate + * checks here. + * + * We set the cpu_vm_mask first to zero to enforce a tlb flush for + * the new context above, then we set it to the current cpu so the + * smp tlb flush routines do not get confused. */ #define activate_context(__tsk) \ do { flushw_user(); \ - spin_lock(&scheduler_lock); \ + (__tsk)->mm->cpu_vm_mask = 0; \ __get_mmu_context(__tsk); \ - spin_unlock(&scheduler_lock); \ + (__tsk)->mm->cpu_vm_mask = (1UL<<smp_processor_id()); \ } while(0) #endif /* !(__ASSEMBLY__) */ diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h index 1e2124797..cd24e96cf 100644 --- a/include/asm-sparc64/namei.h +++ b/include/asm-sparc64/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.13 1998/10/28 08:13:49 jj Exp $ +/* $Id: namei.h,v 1.14 1999/04/06 06:54:39 jj Exp $ * linux/include/asm-sparc64/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -18,11 +18,8 @@ __sparc64_lookup_dentry(const char *name, int lookup_flags) char *emul; switch (current->personality) { -#if 0 -/* Until we solve, why SunOS apps sometime crash, disable gnemul support for SunOS */ case PER_BSD: emul = SPARC_BSD_EMUL; break; -#endif case PER_SVR4: emul = SPARC_SOL_EMUL; break; default: diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h index a878a3ea6..52e55758a 100644 --- a/include/asm-sparc64/oplib.h +++ b/include/asm-sparc64/oplib.h @@ -1,4 +1,4 @@ -/* $Id: oplib.h,v 1.9 1998/10/06 20:56:05 ecd Exp $ +/* $Id: oplib.h,v 1.10 1998/12/18 10:02:03 davem Exp $ * oplib.h: Describes the interface and available routines in the * Linux Prom library. * @@ -175,20 +175,52 @@ enum prom_output_device { extern enum prom_output_device prom_query_output_device(void); /* Multiprocessor operations... */ - +#ifdef __SMP__ /* Start the CPU with the given device tree node, context table, and context * at the passed program counter. */ extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long o0); -/* Stop the CPU with the passed device tree node. */ -extern int prom_stopcpu(int cpunode); +/* Stop the current CPU. */ +extern void prom_stopself(void); + +/* Idle the current CPU. */ +extern void prom_idleself(void); + +/* Resume the CPU with the passed device tree node. */ +extern void prom_resumecpu(int cpunode); +#endif + +/* Power management interfaces. */ + +/* Put the current CPU to sleep. */ +extern void prom_sleepself(void); + +/* Put the entire system to sleep. */ +extern int prom_sleepsystem(void); + +/* Initiate a wakeup event. */ +extern int prom_wakeupsystem(void); + +/* MMU and memory related OBP interfaces. */ + +/* Get unique string identifying SIMM at given physical address. */ +extern int prom_getunumber(unsigned long phys_lo, unsigned long phys_hi, + char *buf, int buflen); + +/* Retain physical memory to the caller across soft resets. */ +extern unsigned long prom_retain(char *name, + unsigned long pa_low, unsigned long pa_high, + long size, long align); -/* Idle the CPU with the passed device tree node. */ -extern int prom_idlecpu(int cpunode); +/* Load explicit I/D TLB entries into the calling processor. */ +extern long prom_itlb_load(unsigned long index, + unsigned long tte_data, + unsigned long vaddr); -/* Re-Start the CPU with the passed device tree node. */ -extern int prom_restartcpu(int cpunode); +extern long prom_dtlb_load(unsigned long index, + unsigned long tte_data, + unsigned long vaddr); /* PROM device tree traversal functions... */ diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h index adb1e10bf..4f0f51f30 100644 --- a/include/asm-sparc64/pbm.h +++ b/include/asm-sparc64/pbm.h @@ -1,4 +1,4 @@ -/* $Id: pbm.h,v 1.14 1998/05/29 06:00:40 ecd Exp $ +/* $Id: pbm.h,v 1.16 1999/03/14 18:13:03 davem Exp $ * pbm.h: U2P PCI bus module pseudo driver software state. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -30,15 +30,21 @@ struct pci_vma { struct linux_psycho; +/* There can be quite a few ranges and interrupt maps on a PCI + * segment. Thus... + */ +#define PROM_PCIRNG_MAX 64 +#define PROM_PCIIMAP_MAX 64 + struct linux_pbm_info { struct linux_psycho *parent; struct pci_vma *IO_assignments; struct pci_vma *MEM_assignments; int prom_node; char prom_name[64]; - struct linux_prom_pci_ranges pbm_ranges[PROMREG_MAX]; + struct linux_prom_pci_ranges pbm_ranges[PROM_PCIRNG_MAX]; int num_pbm_ranges; - struct linux_prom_pci_intmap pbm_intmap[PROMREG_MAX]; + struct linux_prom_pci_intmap pbm_intmap[PROM_PCIIMAP_MAX]; int num_pbm_intmap; struct linux_prom_pci_intmask pbm_intmask; @@ -63,6 +69,8 @@ struct linux_psycho { unsigned int pci_first_busno; unsigned int pci_last_busno; struct pci_bus *pci_bus; + + void *starfire_cookie; }; /* PCI devices which are not bridges have this placed in their pci_dev diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index c074344a4..b4782e72f 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.96 1998/10/27 23:28:42 davem Exp $ +/* $Id: pgtable.h,v 1.103 1999/03/28 08:40:04 davem Exp $ * pgtable.h: SpitFire page table operations. * * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu) @@ -14,6 +14,7 @@ #ifndef __ASSEMBLY__ #include <linux/mm.h> +#include <linux/pagemap.h> #endif #include <asm/spitfire.h> #include <asm/asi.h> @@ -106,8 +107,9 @@ #define PAGE_NONE __pgprot (_PAGE_PRESENT | _PAGE_ACCESSED) +/* Don't set the TTE _PAGE_W bit here, else the dirty bit never gets set. */ #define PAGE_SHARED __pgprot (_PAGE_PRESENT | _PAGE_VALID | _PAGE_CACHE | \ - __ACCESS_BITS | _PAGE_W | _PAGE_WRITE) + __ACCESS_BITS | _PAGE_WRITE) #define PAGE_COPY __pgprot (_PAGE_PRESENT | _PAGE_VALID | _PAGE_CACHE | \ __ACCESS_BITS) @@ -250,11 +252,13 @@ extern __inline__ void flush_tlb_page(struct vm_area_struct *vma, unsigned long #define mk_pte_phys(physpage, pgprot) (__pte((physpage) | pgprot_val(pgprot))) #define pte_modify(_pte, newprot) \ (pte_val(_pte) = ((pte_val(_pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))) -#define pmd_set(pmdp, ptep) (pmd_val(*(pmdp)) = __pa((unsigned long) (ptep))) -#define pgd_set(pgdp, pmdp) (pgd_val(*(pgdp)) = __pa((unsigned long) (pmdp))) +#define pmd_set(pmdp, ptep) \ + (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL)) +#define pgd_set(pgdp, pmdp) \ + (pgd_val(*(pgdp)) = (__pa((unsigned long) (pmdp)) >> 11UL)) #define pte_page(pte) ((unsigned long) __va(((pte_val(pte)&~PAGE_OFFSET)&~(0xfffUL)))) -#define pmd_page(pmd) ((unsigned long) __va(pmd_val(pmd))) -#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd))) +#define pmd_page(pmd) ((unsigned long) __va((pmd_val(pmd)<<11UL))) +#define pgd_page(pgd) ((unsigned long) __va((pgd_val(pgd)<<11UL))) #define pte_none(pte) (!pte_val(pte)) #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) #define pte_clear(pte) (pte_val(*(pte)) = 0UL) @@ -329,8 +333,8 @@ static __inline__ pte_t pte_mkdirty(pte_t _pte) extern struct pgtable_cache_struct { unsigned long *pgd_cache; unsigned long *pte_cache; - unsigned long pgcache_size; - unsigned long pgdcache_size; + unsigned int pgcache_size; + unsigned int pgdcache_size; } pgt_quicklists; #endif #define pgd_quicklist (pgt_quicklists.pgd_cache) @@ -371,7 +375,7 @@ extern __inline__ pgd_t *get_pgd_fast(void) (unsigned long)ret->pprev_hash = mask; if (!mask) pgd_quicklist = (unsigned long *)ret->next_hash; - ret = (struct page *) (page_address(ret) + off); + ret = (struct page *)(page_address(ret) + off); pgd_cache_size--; } else { ret = (struct page *) __get_free_page(GFP_KERNEL); @@ -519,7 +523,7 @@ extern pgd_t swapper_pg_dir[1]; extern inline void SET_PAGE_DIR(struct task_struct *tsk, pgd_t *pgdir) { - if(pgdir != swapper_pg_dir && tsk->mm == current->mm) { + if(pgdir != swapper_pg_dir && tsk == current) { register unsigned long paddr asm("o5"); paddr = __pa(pgdir); @@ -642,9 +646,11 @@ __get_iospace (unsigned long addr) extern void * module_map (unsigned long size); extern void module_unmap (void *addr); +extern unsigned long *sparc64_valid_addr_bitmap; /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (test_bit(PG_skip, &(page)->flags)) +#define kern_addr_valid(addr) (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap)) extern int io_remap_page_range(unsigned long from, unsigned long offset, unsigned long size, pgprot_t prot, int space); diff --git a/include/asm-sparc64/posix_types.h b/include/asm-sparc64/posix_types.h index 2acf3e421..e0836990a 100644 --- a/include/asm-sparc64/posix_types.h +++ b/include/asm-sparc64/posix_types.h @@ -38,7 +38,11 @@ typedef long long __kernel_loff_t; #endif typedef struct { +#if defined(__KERNEL__) || defined(__USE_ALL) int val[2]; +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ + int __val[2]; +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ } __kernel_fsid_t; /* Now 32bit compatibility types */ @@ -62,6 +66,8 @@ typedef unsigned int __kernel_caddr_t32; typedef long __kernel_loff_t32; typedef __kernel_fsid_t __kernel_fsid_t32; +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + #undef __FD_SET static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) { @@ -131,4 +137,6 @@ static __inline__ void __FD_ZERO(__kernel_fd_set *p) } } +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ + #endif /* !(__ARCH_SPARC64_POSIX_TYPES_H) */ diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index f5b7b9e91..0facbaf4f 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.51 1998/10/21 03:21:19 davem Exp $ +/* $Id: processor.h,v 1.53 1999/01/19 07:57:51 davem Exp $ * include/asm-sparc64/processor.h * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -82,7 +82,7 @@ struct thread_struct { #define SPARC_FLAG_PERFCTR 0x200 /* task has performance counters active */ #define INIT_MMAP { &init_mm, 0xfffff80000000000, 0xfffff80001000000, \ - PAGE_SHARED , VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } + NULL, PAGE_SHARED , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_TSS { \ /* ksp, wstate, cwp, flags, ctx, */ \ @@ -200,7 +200,8 @@ do { \ : \ : "r" (regs), "r" (sp - REGWIN32_SZ), \ "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])), \ - "r" (current->mm->pgd[0]), "r" (TSB_REG), "i" (ASI_DMMU)); \ + "r" (((unsigned long)current->mm->pgd[0])<<11UL), \ + "r" (TSB_REG), "i" (ASI_DMMU)); \ } while(0) /* Free all resources held by a thread. */ diff --git a/include/asm-sparc64/psycho.h b/include/asm-sparc64/psycho.h index 35c5c89c3..0833bf0eb 100644 --- a/include/asm-sparc64/psycho.h +++ b/include/asm-sparc64/psycho.h @@ -1,4 +1,4 @@ -/* $Id: psycho.h,v 1.3 1998/03/15 13:24:28 ecd Exp $ +/* $Id: psycho.h,v 1.5 1999/04/01 12:27:28 davem Exp $ * psycho.h: UltraSparc AX specific PCI definitions. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -257,20 +257,49 @@ struct psycho_regs { #define PSYCHO_CEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/ #define PSYCHO_CEAFSR_RESV1 0x0300000000000000 /* Reserved */ #define PSYCHO_CEAFSR_ESYND 0x00ff000000000000 /* Syndrome Bits */ -#define PSYCHO_UEAFSR_SIZE 0x0000ffff00000000 /* Bytemask of failed transfer */ +#define PSYCHO_CEAFSR_SIZE 0x0000ffff00000000 /* Bytemask of failed transfer */ #define PSYCHO_CEAFSR_DOFF 0x00000000e0000000 /* Double Offset */ #define PSYCHO_CEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */ #define PSYCHO_CEAFSR_BLK 0x0000000000800000 /* Trans was block operation */ #define PSYCHO_CEAFSR_RESV2 0x00000000007fffff /* Reserved */ -/* DMA Scoreboard Diagnostic Register(s) */ -#define PSYCHO_DSCORE_VALID 0x8000000000000000 /* Entry is valid */ -#define PSYCHO_DSCORE_C 0x4000000000000000 /* Transaction cacheable */ -#define PSYCHO_DSCORE_READ 0x2000000000000000 /* Transaction was a read */ -#define PSYCHO_DSCORE_TAG 0x1f00000000000000 /* Transaction ID */ -#define PSYCHO_DSCORE_ADDR 0x00fffffffff80000 /* Transaction PADDR */ -#define PSYCHO_DSCORE_BMSK 0x000000000007fff8 /* Bytemask of pending transfer */ -#define PSYCHO_DSCORE_SRC 0x0000000000000007 /* Transaction source */ +/* PSYCHO Performance Monitor Register, the counter holds 2 32-bit event counters. */ +#define PSYCHO_PMCTRL_RESV3 0xffffffffffff0000 /* Reserved */ +#define PSYCHO_PMCTRL_CLR1 0x0000000000008000 /* Clear SEL1 counter */ +#define PSYCHO_PMCTRL_RESV2 0x0000000000006000 /* Reserved */ +#define PSYCHO_PMCTRL_SEL1 0x0000000000001f00 /* Event source 1 */ +#define PSYCHO_PMCTRL_CLR0 0x0000000000000080 /* Clear SEL0 counter */ +#define PSYCHO_PMCTRL_RESV1 0x0000000000000060 /* Reserved */ +#define PSYCHO_PMCTRL_SEL0 0x000000000000001f /* Event source 0 */ + +/* SEL0/SEL1 each can take any one of the following values. */ +#define PMCTRL_SEL_NSDRA 0x00 /* # of streaming dvma reads for PCI A */ +#define PMCTRL_SEL_NSDWA 0x01 /* # of streaming dvma writes for PCI A */ +#define PMCTRL_SEL_NCDRA 0x02 /* # of consistent dvma reads for PCI A */ +#define PMCTRL_SEL_NCDWA 0x03 /* # of consistent dvma writes for PCI A */ +#define PMCTRL_SEL_SBMA 0x04 /* # of streaming buffer misses on PCI A */ +#define PMCTRL_SEL_DCGA 0x05 /* # of DVMA granted cycles on PCI A */ +#define PMCTRL_SEL_DWTA 0x06 /* # of DVMA words transferred on PCI A */ +#define PMCTRL_SEL_CPIOA 0x07 /* # of PIO cycles used by PSYCHO on PCI A */ +#define PMCTRL_SEL_NSDRB 0x08 /* # of streaming dvma reads for PCI B */ +#define PMCTRL_SEL_NSDWB 0x09 /* # of streaming dvma writes for PCI B */ +#define PMCTRL_SEL_NCDRB 0x0a /* # of consistent dvma reads for PCI B */ +#define PMCTRL_SEL_NCDWB 0x0b /* # of consistent dvma writes for PCI B */ +#define PMCTRL_SEL_SBMB 0x0c /* # of streaming buffer misses on PCI B */ +#define PMCTRL_SEL_DCGB 0x0d /* # of DVMA granted cycles on PCI B */ +#define PMCTRL_SEL_DWTB 0x0e /* # of DVMA words transferred on PCI B */ +#define PMCTRL_SEL_CPIOB 0x0f /* # of PIO cycles used by PSYCHO on PCI B */ +#define PMCTRL_SEL_TMISS 0x10 /* # of IOMMU TLB misses */ +#define PMCTRL_SEL_IRQ 0x11 /* # of interrupts */ +#define PMCTRL_SEL_INACK 0x12 /* # of interrupt NACKs on UPA */ +#define PMCTRL_SEL_PRD 0x13 /* # of PIO reads */ +#define PMCTRL_SEL_PWR 0x14 /* # of PIO writes */ +#define PMCTRL_SEL_MBT 0x15 /* # of Merge Buffer transactions */ +#define PMCTRL_SEL_PDRTA 0x16 /* # of PCI A DVMA tablewalk induced retries */ +#define PMCTRL_SEL_PDRSA 0x17 /* # of PCI A DVMA str buf induced retries */ +#define PMCTRL_SEL_PDRTB 0x18 /* # of PCI B DVMA tablewalk induced retries */ +#define PMCTRL_SEL_PDRSB 0x19 /* # of PCI B DVMA str buf induced retries */ +/* Values 0x1a --> 0x1f are reserved. */ /* PSYCHO PCI Control Register */ #define PSYCHO_PCICTRL_RESV1 0xfffffff000000000 /* Reserved */ @@ -302,6 +331,16 @@ struct psycho_regs { #define PSYCHO_PCIAFSR_MID 0x000000003e000000 /* MID causing the error */ #define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffff /* Reserved */ +/* PSYCHO Diagnostic Register. */ +#define PSYCHO_PSYDIAG_RESV 0xffffffffffffff80 /* Reserved */ +#define PSYCHO_PCIDIAG_DRETRY 0x0000000000000040 /* Disable retry limit */ +#define PSYCHO_PCIDIAG_DISYNC 0x0000000000000020 /* Disable DMA wr / irq sync */ +#define PSYCHO_PCIDIAG_DDWSYNC 0x0000000000000010 /* Disable DMA wr / PIO rd sync */ +#define PSYCHO_PCIDIAG_IDDPAR 0x0000000000000008 /* Invert DMA data parity */ +#define PSYCHO_PCIDIAG_IPDPAR 0x0000000000000004 /* Invert PIO data parity */ +#define PSYCHO_PCIDIAG_IPAPAR 0x0000000000000002 /* Invert PIO address parity */ +#define PSYCHO_PCIDIAG_LPBACK 0x0000000000000001 /* Enable loopback mode */ + /* IOMMU things defined fully in asm-sparc64/iommu.h */ /* Streaming Buffer Control Register */ @@ -320,6 +359,15 @@ struct psycho_regs { #define PSYCHO_SBUFSYNC_ADDR 0x000001ffffffffc0 /* Physical address to update */ #define PSYCHO_SBUFSYNC_RESV 0x000000000000003f /* Ignored bits */ +/* DMA Scoreboard Diagnostic Register(s) */ +#define PSYCHO_DSCORE_VALID 0x8000000000000000 /* Entry is valid */ +#define PSYCHO_DSCORE_C 0x4000000000000000 /* Transaction cacheable */ +#define PSYCHO_DSCORE_READ 0x2000000000000000 /* Transaction was a read */ +#define PSYCHO_DSCORE_TAG 0x1f00000000000000 /* Transaction ID */ +#define PSYCHO_DSCORE_ADDR 0x00fffffffff80000 /* Transaction PADDR */ +#define PSYCHO_DSCORE_BMSK 0x000000000007fff8 /* Bytemask of pending transfer */ +#define PSYCHO_DSCORE_SRC 0x0000000000000007 /* Transaction source */ + /* PSYCHO Interrupt mapping register(s). */ #define PSYCHO_IMAP_RESV1 0xffffffff00000000 /* Reserved */ #define PSYCHO_IMAP_VALID 0x0000000080000000 /* This enables delivery. */ diff --git a/include/asm-sparc64/resource.h b/include/asm-sparc64/resource.h index b3aedd4ee..02ba40894 100644 --- a/include/asm-sparc64/resource.h +++ b/include/asm-sparc64/resource.h @@ -1,4 +1,4 @@ -/* $Id: resource.h,v 1.3 1997/06/14 17:35:09 davem Exp $ +/* $Id: resource.h,v 1.4 1998/11/19 20:01:49 davem Exp $ * resource.h: Resource definitions. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -28,7 +28,7 @@ #define INIT_RLIMITS \ { \ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ - {LONG_MAX, LONG_MAX}, {_STK_LIM, _STK_LIM}, \ + {LONG_MAX, LONG_MAX}, {_STK_LIM, LONG_MAX}, \ { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ {NR_OPEN, NR_OPEN}, {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX} \ diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h index ea2f85132..f3169c8ce 100644 --- a/include/asm-sparc64/sbus.h +++ b/include/asm-sparc64/sbus.h @@ -1,4 +1,4 @@ -/* $Id: sbus.h,v 1.7 1998/05/22 14:33:40 jj Exp $ +/* $Id: sbus.h,v 1.10 1998/12/16 04:33:58 davem Exp $ * sbus.h: Defines for the Sun SBus. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -74,6 +74,8 @@ struct linux_sbus { int clock_freq; struct linux_prom_ranges sbus_ranges[PROMREG_MAX]; int num_sbus_ranges; + int upaid; + void *starfire_cookie; }; extern struct linux_sbus *SBus_chain; @@ -88,6 +90,16 @@ extern struct linux_sbus *SBus_chain; #define for_all_sbusdev(device, bus) \ for((bus) = SBus_chain, ((device) = (bus) ? (bus)->devices : 0); (bus); (device)=((device)->next ? (device)->next : ((bus) = (bus)->next, (bus) ? (bus)->devices : 0))) +extern void mmu_set_sbus64(struct linux_sbus_device *, int); + +/* If you did not get the buffer from mmu_get_*() or sparc_alloc_dvma() + * then you must use this to get the 32-bit SBUS dvma address. + * And in this case it is your responsibility to make sure the buffer + * is GFP_DMA, ie. that it is not greater than MAX_DMA_ADDRESS. + */ +extern unsigned long phys_base; +#define sbus_dvma_addr(__addr) ((__u32)(__pa(__addr) - phys_base)) + /* Apply promlib probed SBUS ranges to registers. */ extern void prom_apply_sbus_ranges(struct linux_sbus *sbus, struct linux_prom_registers *sbusregs, int nregs, diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h index 699ef9b07..9811fc06e 100644 --- a/include/asm-sparc64/scatterlist.h +++ b/include/asm-sparc64/scatterlist.h @@ -1,4 +1,4 @@ -/* $Id: scatterlist.h,v 1.4 1997/04/10 05:13:32 davem Exp $ */ +/* $Id: scatterlist.h,v 1.6 1998/12/16 04:33:57 davem Exp $ */ #ifndef _SPARC64_SCATTERLIST_H #define _SPARC64_SCATTERLIST_H @@ -13,6 +13,7 @@ struct scatterlist { __u32 dvma_address; /* A place to hang host-specific addresses at. */ }; -#define ISA_DMA_THRESHOLD ((0xf0000000) + PAGE_OFFSET) +extern unsigned long phys_base; +#define ISA_DMA_THRESHOLD (phys_base + (0xfe000000UL) + PAGE_OFFSET) #endif /* !(_SPARC64_SCATTERLIST_H) */ diff --git a/include/asm-sparc64/semaphore-helper.h b/include/asm-sparc64/semaphore-helper.h new file mode 100644 index 000000000..67edac693 --- /dev/null +++ b/include/asm-sparc64/semaphore-helper.h @@ -0,0 +1,68 @@ +#ifndef _SPARC64_SEMAPHORE_HELPER_H +#define _SPARC64_SEMAPHORE_HELPER_H + +/* + * SMP- and interrupt-safe semaphore helper functions, sparc64 version. + * + * (C) Copyright 1999 David S. Miller (davem@redhat.com) + * (C) Copyright 1999 Jakub Jelinek (jj@ultra.linux.cz) + */ +#define wake_one_more(__sem) atomic_inc(&((__sem)->waking)); +#define waking_non_zero(__sem) \ +({ int __ret; \ + __asm__ __volatile__( \ +"1: ldsw [%1], %%g5\n\t" \ + "brlez,pt %%g5, 2f\n\t" \ + " mov 0, %0\n\t" \ + "sub %%g5, 1, %%g7\n\t" \ + "cas [%1], %%g5, %%g7\n\t" \ + "cmp %%g5, %%g7\n\t" \ + "bne,pn %%icc, 1b\n\t" \ + " mov 1, %0\n" \ +"2:" : "=&r" (__ret) \ + : "r" (&((__sem)->waking)) \ + : "g5", "g7", "cc", "memory"); \ + __ret; \ +}) + +#define waking_non_zero_interruptible(__sem, __tsk) \ +({ int __ret; \ + __asm__ __volatile__( \ +"1: ldsw [%1], %%g5\n\t" \ + "brlez,pt %%g5, 2f\n\t" \ + " mov 0, %0\n\t" \ + "sub %%g5, 1, %%g7\n\t" \ + "cas [%1], %%g5, %%g7\n\t" \ + "cmp %%g5, %%g7\n\t" \ + "bne,pn %%icc, 1b\n\t" \ + " mov 1, %0\n" \ +"2:" : "=&r" (__ret) \ + : "r" (&((__sem)->waking)) \ + : "g5", "g7", "cc", "memory"); \ + if(__ret == 0 && signal_pending(__tsk)) { \ + atomic_inc(&((__sem)->count)); \ + __ret = -EINTR; \ + } \ + __ret; \ +}) + +#define waking_non_zero_trylock(__sem) \ +({ int __ret; \ + __asm__ __volatile__( \ +"1: ldsw [%1], %%g5\n\t" \ + "brlez,pt %%g5, 2f\n\t" \ + " mov 1, %0\n\t" \ + "sub %%g5, 1, %%g7\n\t" \ + "cas [%1], %%g5, %%g7\n\t" \ + "cmp %%g5, %%g7\n\t" \ + "bne,pn %%icc, 1b\n\t" \ + " mov 0, %0\n" \ +"2:" : "=&r" (__ret) \ + : "r" (&((__sem)->waking)) \ + : "g5", "g7", "cc", "memory"); \ + if(__ret == 1) \ + atomic_inc(&((__sem)->count)); \ + __ret; \ +}) + +#endif /* !(_SPARC64_SEMAPHORE_HELPER_H) */ diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h index 48d96f23d..e35a66513 100644 --- a/include/asm-sparc64/semaphore.h +++ b/include/asm-sparc64/semaphore.h @@ -18,57 +18,135 @@ struct semaphore { extern void __down(struct semaphore * sem); extern int __down_interruptible(struct semaphore * sem); +extern int __down_trylock(struct semaphore * sem); extern void __up(struct semaphore * sem); #define sema_init(sem, val) atomic_set(&((sem)->count), val) -#define wake_one_more(sem) atomic_inc(&sem->waking); - -static __inline__ int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) -{ - int ret; - - __asm__ __volatile__(" -1: ldsw [%1], %%g5 - brlez,pt %%g5, 2f - mov 0, %0 - sub %%g5, 1, %%g7 - cas [%1], %%g5, %%g7 - cmp %%g5, %%g7 - bne,pn %%icc, 1b - mov 1, %0 -2:" : "=r" (ret) - : "r" (&((sem)->waking)) - : "g5", "g7", "cc", "memory"); - return ret; -} - extern __inline__ void down(struct semaphore * sem) { - int result; - - result = atomic_dec_return(&sem->count); - membar("#StoreLoad | #StoreStore"); - if (result < 0) - __down(sem); + __asm__ __volatile__(" + 1: lduw [%0], %%g5 + sub %%g5, 1, %%g7 + cas [%0], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%icc, 1b + cmp %%g7, 1 + bl,pn %%icc, 3f + membar #StoreStore + 2: + .subsection 2 + 3: mov %0, %%g5 + save %%sp, -160, %%sp + mov %%g1, %%l1 + mov %%g2, %%l2 + mov %%g3, %%l3 + call %1 + mov %%g5, %%o0 + mov %%l1, %%g1 + mov %%l2, %%g2 + ba,pt %%xcc, 2b + restore %%l3, %%g0, %%g3 + .previous\n" + : : "r" (__atomic_fool_gcc(sem)), "i" (__down) + : "g5", "g7", "memory", "cc"); } extern __inline__ int down_interruptible(struct semaphore *sem) { - int result, ret = 0; + int ret = 0; + + __asm__ __volatile__(" + 1: lduw [%2], %%g5 + sub %%g5, 1, %%g7 + cas [%2], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%icc, 1b + cmp %%g7, 1 + bl,pn %%icc, 3f + membar #StoreStore + 2: + .subsection 2 + 3: mov %2, %%g5 + save %%sp, -160, %%sp + mov %%g1, %%l1 + mov %%g2, %%l2 + mov %%g3, %%l3 + call %3 + mov %%g5, %%o0 + mov %%l1, %%g1 + mov %%l2, %%g2 + mov %%l3, %%g3 + ba,pt %%xcc, 2b + restore %%o0, %%g0, %0 + .previous\n" + : "=r" (ret) + : "0" (ret), "r" (__atomic_fool_gcc(sem)), "i" (__down_interruptible) + : "g5", "g7", "memory", "cc"); + return ret; +} - result = atomic_dec_return(&sem->count); - membar("#StoreLoad | #StoreStore"); - if (result < 0) - ret = __down_interruptible(sem); +extern inline int down_trylock(struct semaphore *sem) +{ + int ret = 0; + __asm__ __volatile__(" + 1: lduw [%2], %%g5 + sub %%g5, 1, %%g7 + cas [%2], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%icc, 1b + cmp %%g7, 1 + bl,pn %%icc, 3f + membar #StoreStore + 2: + .subsection 2 + 3: mov %2, %%g5 + save %%sp, -160, %%sp + mov %%g1, %%l1 + mov %%g2, %%l2 + mov %%g3, %%l3 + call %3 + mov %%g5, %%o0 + mov %%l1, %%g1 + mov %%l2, %%g2 + mov %%l3, %%g3 + ba,pt %%xcc, 2b + restore %%o0, %%g0, %0 + .previous\n" + : "=r" (ret) + : "0" (ret), "r" (__atomic_fool_gcc(sem)), "i" (__down_trylock) + : "g5", "g7", "memory", "cc"); return ret; } extern __inline__ void up(struct semaphore * sem) { - membar("#StoreStore | #LoadStore"); - if (atomic_inc_return(&sem->count) <= 0) - __up(sem); + __asm__ __volatile__(" + membar #StoreLoad | #LoadLoad + 1: lduw [%0], %%g5 + add %%g5, 1, %%g7 + cas [%0], %%g5, %%g7 + cmp %%g5, %%g7 + bne,pn %%icc, 1b + addcc %%g7, 1, %%g0 + ble,pn %%icc, 3f + nop + 2: + .subsection 2 + 3: mov %0, %%g5 + save %%sp, -160, %%sp + mov %%g1, %%l1 + mov %%g2, %%l2 + mov %%g3, %%l3 + call %1 + mov %%g5, %%o0 + mov %%l1, %%g1 + mov %%l2, %%g2 + ba,pt %%xcc, 2b + restore %%l3, %%g0, %%g3 + .previous\n" + : : "r" (__atomic_fool_gcc(sem)), "i" (__up) + : "g5", "g7", "memory", "cc"); } #endif /* __KERNEL__ */ diff --git a/include/asm-sparc64/siginfo.h b/include/asm-sparc64/siginfo.h index b3ccd57a9..a23240e66 100644 --- a/include/asm-sparc64/siginfo.h +++ b/include/asm-sparc64/siginfo.h @@ -201,7 +201,7 @@ typedef struct siginfo32 { */ #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ -#define NSIGTRAP +#define NSIGTRAP 2 /* * SIGCHLD si_codes diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index f15e6e769..c5e99dab3 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h @@ -20,7 +20,7 @@ struct prom_cpuinfo { }; extern int linux_num_cpus; /* number of CPUs probed */ -extern struct prom_cpuinfo linux_cpus[NR_CPUS]; +extern struct prom_cpuinfo linux_cpus[64]; #endif /* !(__ASSEMBLY__) */ @@ -40,10 +40,15 @@ struct cpuinfo_sparc { unsigned long udelay_val; /* Dcache line 2 */ - unsigned long pgcache_size; + unsigned int pgcache_size; + unsigned int pgdcache_size; unsigned long *pte_cache; - unsigned long pgdcache_size; unsigned long *pgd_cache; + unsigned int idle_volume; + unsigned int __pad; + + /* Dcache lines 3 and 4 */ + unsigned int irq_worklists[16]; }; extern struct cpuinfo_sparc cpu_data[NR_CPUS]; @@ -73,21 +78,42 @@ extern __inline__ int cpu_logical_map(int cpu) extern __inline__ int hard_smp_processor_id(void) { - unsigned long upaconfig; - - __asm__ __volatile__("ldxa [%%g0] %1, %0" - : "=r" (upaconfig) - : "i" (ASI_UPA_CONFIG)); - return ((upaconfig >> 17) & 0x1f); + extern int this_is_starfire; + + if(this_is_starfire != 0) { + extern int starfire_hard_smp_processor_id(void); + + return starfire_hard_smp_processor_id(); + } else { + unsigned long upaconfig; + __asm__ __volatile__("ldxa [%%g0] %1, %0" + : "=r" (upaconfig) + : "i" (ASI_UPA_CONFIG)); + return ((upaconfig >> 17) & 0x1f); + } } #define smp_processor_id() (current->processor) -extern void smp_message_pass(int target, int msg, unsigned long data, int wait); +/* This needn't do anything as we do not sleep the cpu + * inside of the idler task, so an interrupt is not needed + * to get a clean fast response. + * + * Addendum: We do want it to do something for the signal + * delivery case, we detect that by just seeing + * if we are trying to send this to an idler or not. + */ +extern __inline__ void smp_send_reschedule(int cpu) +{ + extern void smp_receive_signal(int); + if(cpu_data[cpu].idle_volume == 0) + smp_receive_signal(cpu); +} -/* As idle task checks need_resched in a tight loop, it is not necessary to - wake it up. -jj */ -#define smp_send_reschedule(cpu) do {} while (0) +/* This is a nop as well because we capture all other cpus + * anyways when making the PROM active. + */ +extern __inline__ void smp_send_stop(void) { } #endif /* !(__ASSEMBLY__) */ diff --git a/include/asm-sparc64/softirq.h b/include/asm-sparc64/softirq.h index a8de6fb1d..f249cd698 100644 --- a/include/asm-sparc64/softirq.h +++ b/include/asm-sparc64/softirq.h @@ -8,6 +8,7 @@ #include <asm/atomic.h> #include <asm/hardirq.h> +#include <asm/system.h> /* for membar() */ #ifndef __SMP__ extern unsigned int local_bh_count; @@ -36,14 +37,15 @@ extern unsigned int local_bh_count; extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } extern inline void remove_bh(int nr) { - bh_base[nr] = NULL; bh_mask &= ~(1 << nr); + membar("#StoreStore"); + bh_base[nr] = NULL; } extern inline void mark_bh(int nr) @@ -116,13 +118,13 @@ static inline void softirq_endlock(int cpu) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); synchronize_bh(); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h index 5f65fc78f..1d3b35020 100644 --- a/include/asm-sparc64/spinlock.h +++ b/include/asm-sparc64/spinlock.h @@ -149,9 +149,9 @@ extern __inline__ void spin_unlock_irq(spinlock_t *lock) : "memory"); } -#define spin_lock_irqsave(lock, flags) \ -do { register spinlock_t *lp asm("g1"); \ - lp = lock; \ +#define spin_lock_irqsave(__lock, flags) \ +do { register spinlock_t *__lp asm("g1"); \ + __lp = (__lock); \ __asm__ __volatile__( \ "\n rdpr %%pil, %0\n" \ " wrpr %%g0, 15, %%pil\n" \ @@ -165,7 +165,7 @@ do { register spinlock_t *lp asm("g1"); \ " b,a,pt %%xcc, 1b\n" \ " .previous\n" \ : "=&r" (flags) \ - : "r" (lp) \ + : "r" (__lp) \ : "g7", "memory"); \ } while(0) diff --git a/include/asm-sparc64/sysio.h b/include/asm-sparc64/sysio.h index 2fdcc9317..8508f7e0c 100644 --- a/include/asm-sparc64/sysio.h +++ b/include/asm-sparc64/sysio.h @@ -1,4 +1,4 @@ -/* $Id: sysio.h,v 1.7 1997/08/18 03:47:26 davem Exp $ +/* $Id: sysio.h,v 1.8 1998/11/29 15:49:54 davem Exp $ * sysio.h: UltraSparc sun5 specific SBUS definitions. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -260,7 +260,8 @@ struct sysio_regs { #define SYSIO_SBCNTRL_DPERR 0x003f000000000000 /* DMA Write Parity Error */ #define SYSIO_SBCNTRL_RESV2 0x0000800000000000 /* Reserved */ #define SYSIO_SBCNTRL_PPERR 0x00007f0000000000 /* PIO Load Parity Error */ -#define SYSIO_SBCNTRL_RESV 0x000000fffffffc00 /* Reserved */ +#define SYSIO_SBCNTRL_RESV 0x000000fffffff800 /* Reserved */ +#define SYSIO_SBCNTRL_FAST 0x0000000000000400 /* Enable Fast-SBUS mode. */ #define SYSIO_SBCNTRL_WEN 0x0000000000000200 /* Power Mgmt Wake Enable */ #define SYSIO_SBCNTRL_EEN 0x0000000000000100 /* SBUS Error Interrupt Enable */ #define SYSIO_SBCNTRL_RESV3 0x00000000000000c0 /* Reserved */ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 6212bd223..82cf1eb41 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.47 1998/10/21 03:21:20 davem Exp $ */ +/* $Id: system.h,v 1.50 1999/05/08 03:03:22 davem Exp $ */ #ifndef __SPARC64_SYSTEM_H #define __SPARC64_SYSTEM_H @@ -48,7 +48,7 @@ extern unsigned long empty_zero_page; ({ unsigned long retval; \ __asm__ __volatile__("rdpr %%pil, %0\n\t" \ "wrpr %1, %%pil" \ - : "=r" (retval) \ + : "=&r" (retval) \ : "r" (__new_pil) \ : "memory"); \ retval; \ @@ -95,6 +95,8 @@ extern void __global_restore_flags(unsigned long flags); #define nop() __asm__ __volatile__ ("nop") #define membar(type) __asm__ __volatile__ ("membar " type : : : "memory"); +#define rmb() membar("#LoadLoad | #LoadStore") +#define wmb() membar("#StoreLoad | #StoreStore") #define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") @@ -125,21 +127,14 @@ extern __inline__ void flushw_user(void) /* See what happens when you design the chip correctly? * - * XXX What we are doing here assumes a lot about gcc reload - * XXX internals, it heavily risks compiler aborts due to - * XXX forbidden registers being spilled. Rewrite me... -DaveM - * - * SMP NOTE: At first glance it looks like there is a tiny - * race window here at the end. The possible problem - * would be if a tlbcachesync MONDO vector got delivered - * to us right before we set the final %g6 thread reg - * value. But that is impossible since only the holder - * of scheduler_lock can send a tlbcachesync MONDO and - * by definition we hold it right now. Normal tlb - * flush xcalls can come in, but those are safe and do - * not reference %g6. + * We tell gcc we clobber all non-fixed-usage registers except + * for l0/l1. It will use one for 'next' and the other to hold + * the output value of 'last'. 'next' is not referenced again + * past the invocation of switch_to in the scheduler, so we need + * not preserve it's value. Hairy, but it lets us remove 2 loads + * and 2 stores in this critical code path. -DaveM */ -#define switch_to(prev, next) \ +#define switch_to(prev, next, last) \ do { if (current->tss.flags & SPARC_FLAG_PERFCTR) { \ unsigned long __tmp; \ read_pcr(__tmp); \ @@ -155,26 +150,23 @@ do { if (current->tss.flags & SPARC_FLAG_PERFCTR) { \ __get_mmu_context(next); \ (next)->mm->cpu_vm_mask |= (1UL << smp_processor_id()); \ __asm__ __volatile__( \ + "mov %%g6, %%g5\n\t" \ "wrpr %%g0, 0x95, %%pstate\n\t" \ - "stx %%l0, [%%sp + 2047 + 0x60]\n\t" \ - "stx %%l1, [%%sp + 2047 + 0x68]\n\t" \ "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ "rdpr %%wstate, %%o5\n\t" \ - "stx %%o6, [%%g6 + %2]\n\t" \ - "sth %%o5, [%%g6 + %1]\n\t" \ + "stx %%o6, [%%g6 + %3]\n\t" \ + "sth %%o5, [%%g6 + %2]\n\t" \ "rdpr %%cwp, %%o5\n\t" \ - "sth %%o5, [%%g6 + %4]\n\t" \ - "mov %0, %%g6\n\t" \ - "lduh [%0 + %4], %%g1\n\t" \ + "sth %%o5, [%%g6 + %5]\n\t" \ + "mov %1, %%g6\n\t" \ + "lduh [%1 + %5], %%g1\n\t" \ "wrpr %%g1, %%cwp\n\t" \ - "ldx [%%g6 + %2], %%o6\n\t" \ - "lduh [%%g6 + %1], %%o5\n\t" \ - "lduh [%%g6 + %3], %%o7\n\t" \ + "ldx [%%g6 + %3], %%o6\n\t" \ + "lduh [%%g6 + %2], %%o5\n\t" \ + "lduh [%%g6 + %4], %%o7\n\t" \ "mov %%g6, %%l2\n\t" \ "wrpr %%o5, 0x0, %%wstate\n\t" \ - "ldx [%%sp + 2047 + 0x60], %%l0\n\t" \ - "ldx [%%sp + 2047 + 0x68], %%l1\n\t" \ "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ "wrpr %%g0, 0x94, %%pstate\n\t" \ @@ -182,8 +174,8 @@ do { if (current->tss.flags & SPARC_FLAG_PERFCTR) { \ "wrpr %%g0, 0x96, %%pstate\n\t" \ "andcc %%o7, 0x100, %%g0\n\t" \ "bne,pn %%icc, ret_from_syscall\n\t" \ - " nop\n\t" \ - : \ + " mov %%g5, %0\n\t" \ + : "=&r" (last) \ : "r" (next), \ "i" ((const unsigned long)(&((struct task_struct *)0)->tss.wstate)), \ "i" ((const unsigned long)(&((struct task_struct *)0)->tss.ksp)), \ diff --git a/include/asm-sparc64/termbits.h b/include/asm-sparc64/termbits.h index 5c89cd6ca..6d490333c 100644 --- a/include/asm-sparc64/termbits.h +++ b/include/asm-sparc64/termbits.h @@ -159,6 +159,17 @@ struct termios { #define B307200 0x00001007 #define B614400 0x00001008 #define B921600 0x00001009 +/* And these are the rest... */ +#define B500000 0x0000100a +#define B576000 0x0000100b +#define B1000000 0x0000100c +#define B1152000 0x0000100d +#define B1500000 0x0000100e +#define B2000000 0x0000100f +#define B2500000 0x00001010 +#define B3000000 0x00001011 +#define B3500000 0x00001012 +#define B4000000 0x00001013 #define CIBAUD 0x100f0000 /* input baud rate (not used) */ #define CMSPAR 0x40000000 /* mark or space (stick) parity */ #define CRTSCTS 0x80000000 /* flow control */ diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h index 607ad1440..3f77c8dbf 100644 --- a/include/asm-sparc64/termios.h +++ b/include/asm-sparc64/termios.h @@ -1,4 +1,4 @@ -/* $Id: termios.h,v 1.6 1998/10/04 06:50:15 davem Exp $ */ +/* $Id: termios.h,v 1.8 1999/03/25 09:11:26 davem Exp $ */ #ifndef _SPARC64_TERMIOS_H #define _SPARC64_TERMIOS_H @@ -68,6 +68,7 @@ struct winsize { #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ #ifdef __KERNEL__ diff --git a/include/asm-sparc64/timex.h b/include/asm-sparc64/timex.h index 80210c259..b8d586e4f 100644 --- a/include/asm-sparc64/timex.h +++ b/include/asm-sparc64/timex.h @@ -12,4 +12,13 @@ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +/* Getting on the cycle counter on sparc64. */ +typedef unsigned long cycles_t; +extern cycles_t cacheflush_time; +#define get_cycles() \ +({ cycles_t ret; \ + __asm__("rd %%tick, %0" : "=r" (ret)); \ + ret; \ +}) + #endif diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h index 2cd04004a..7619264ae 100644 --- a/include/asm-sparc64/ttable.h +++ b/include/asm-sparc64/ttable.h @@ -1,4 +1,4 @@ -/* $Id: ttable.h,v 1.10 1998/09/25 01:09:45 davem Exp $ */ +/* $Id: ttable.h,v 1.11 1999/03/29 12:38:12 jj Exp $ */ #ifndef _SPARC64_TTABLE_H #define _SPARC64_TTABLE_H @@ -29,11 +29,21 @@ clr %l6; \ nop; +#define TRAP_SAVEFPU(routine) \ + sethi %hi(109f), %g7; \ + ba,pt %xcc, do_fptrap; \ +109: or %g7, %lo(109b), %g7; \ + call routine; \ + add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ + ba,pt %xcc, rtrap; \ + clr %l6; \ + nop; + #define TRAP_NOSAVE(routine) \ ba,pt %xcc, routine; \ nop; \ nop; nop; nop; nop; nop; nop; - + #define TRAPTL1(routine) \ sethi %hi(109f), %g7; \ ba,pt %xcc, etraptl1; \ diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h index 93c14ae3f..0643d0487 100644 --- a/include/asm-sparc64/uaccess.h +++ b/include/asm-sparc64/uaccess.h @@ -1,4 +1,4 @@ -/* $Id: uaccess.h,v 1.28 1998/10/11 06:58:34 davem Exp $ */ +/* $Id: uaccess.h,v 1.29 1999/05/08 03:03:25 davem Exp $ */ #ifndef _ASM_UACCESS_H #define _ASM_UACCESS_H @@ -41,12 +41,9 @@ #define segment_eq(a,b) ((a).seg == (b).seg) -extern spinlock_t scheduler_lock; - #define set_fs(val) \ do { \ if (current->tss.current_ds.seg != val.seg) { \ - spin_lock(&scheduler_lock); \ current->tss.current_ds = (val); \ if (segment_eq((val), KERNEL_DS)) { \ flushw_user (); \ @@ -56,7 +53,6 @@ do { \ } \ spitfire_set_secondary_context(current->tss.ctx); \ __asm__ __volatile__("flush %g6"); \ - spin_unlock(&scheduler_lock); \ } \ } while(0) diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index 2db3c1547..87a6833c5 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h @@ -1,4 +1,4 @@ -/* $Id: unistd.h,v 1.23 1998/10/07 01:28:02 davem Exp $ */ +/* $Id: unistd.h,v 1.28 1999/04/07 17:14:19 davem Exp $ */ #ifndef _SPARC64_UNISTD_H #define _SPARC64_UNISTD_H @@ -46,11 +46,11 @@ #define __NR_sigaltstack 28 /* Common */ #define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */ #define __NR_utime 30 /* Implemented via utimes() under SunOS */ -#define __NR_stty 31 /* Implemented via ioctl() under SunOS */ -#define __NR_gtty 32 /* Implemented via ioctl() under SunOS */ +/* #define __NR_stty 31 Implemented via ioctl() under SunOS */ +/* #define __NR_gtty 32 Implemented via ioctl() under SunOS */ #define __NR_access 33 /* Common */ #define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */ -#define __NR_ftime 35 /* Implemented via gettimeofday() in SunOS */ +/* #define __NR_ftime 35 Implemented via gettimeofday() in SunOS */ #define __NR_sync 36 /* Common */ #define __NR_kill 37 /* Common */ #define __NR_stat 38 /* Common */ @@ -59,8 +59,8 @@ #define __NR_dup 41 /* Common */ #define __NR_pipe 42 /* Common */ #define __NR_times 43 /* Implemented via getrusage() in SunOS */ -#define __NR_profil 44 /* Common */ -/* #define __NR_ni_syscall 45 ENOSYS under SunOS */ +/* #define __NR_profil 44 Common */ +#define __NR_umount2 45 /* Linux Specific */ #define __NR_setgid 46 /* Implemented via setregid() in SunOS */ #define __NR_getgid 47 /* Common */ #define __NR_signal 48 /* Implemented via sigvec() in SunOS */ @@ -68,7 +68,7 @@ #define __NR_getegid 50 /* SunOS calls getgid() */ #define __NR_acct 51 /* Common */ #define __NR_memory_ordering 52 /* Linux Specific */ -#define __NR_mctl 53 /* SunOS specific */ +/* #define __NR_mctl 53 SunOS specific */ #define __NR_ioctl 54 /* Common */ #define __NR_reboot 55 /* Common */ /* #define __NR_ni_syscall 56 ENOSYS under SunOS */ @@ -81,35 +81,35 @@ /* #define __NR_ni_syscall 63 ENOSYS under SunOS */ #define __NR_getpagesize 64 /* Common */ #define __NR_msync 65 /* Common in newer 1.3.x revs... */ -/* #define __NR_ni_syscall 66 ENOSYS under SunOS */ +#define __NR_vfork 66 /* Common */ #define __NR_pread 67 /* Linux Specific */ #define __NR_pwrite 68 /* Linux Specific */ -#define __NR_sbrk 69 /* SunOS Specific */ -#define __NR_sstk 70 /* SunOS Specific */ +/* #define __NR_sbrk 69 SunOS Specific */ +/* #define __NR_sstk 70 SunOS Specific */ #define __NR_mmap 71 /* Common */ -#define __NR_vadvise 72 /* SunOS Specific */ +/* #define __NR_vadvise 72 SunOS Specific */ #define __NR_munmap 73 /* Common */ #define __NR_mprotect 74 /* Common */ -#define __NR_madvise 75 /* SunOS Specific */ +/* #define __NR_madvise 75 SunOS Specific */ #define __NR_vhangup 76 /* Common */ /* #define __NR_ni_syscall 77 ENOSYS under SunOS */ -#define __NR_mincore 78 /* SunOS Specific */ +/* #define __NR_mincore 78 SunOS Specific */ #define __NR_getgroups 79 /* Common */ #define __NR_setgroups 80 /* Common */ #define __NR_getpgrp 81 /* Common */ -#define __NR_setpgrp 82 /* setpgid, same difference... */ +/* #define __NR_setpgrp 82 setpgid, same difference... */ #define __NR_setitimer 83 /* Common */ /* #define __NR_ni_syscall 84 ENOSYS under SunOS */ #define __NR_swapon 85 /* Common */ #define __NR_getitimer 86 /* Common */ -#define __NR_gethostname 87 /* SunOS Specific */ +/* #define __NR_gethostname 87 SunOS Specific */ #define __NR_sethostname 88 /* Common */ -#define __NR_getdtablesize 89 /* SunOS Specific */ +/* #define __NR_getdtablesize 89 SunOS Specific */ #define __NR_dup2 90 /* Common */ -#define __NR_getdopt 91 /* SunOS Specific */ +/* #define __NR_getdopt 91 SunOS Specific */ #define __NR_fcntl 92 /* Common */ #define __NR_select 93 /* Common */ -#define __NR_setdopt 94 /* SunOS Specific */ +/* #define __NR_setdopt 94 SunOS Specific */ #define __NR_fsync 95 /* Common */ #define __NR_setpriority 96 /* Common */ #define __NR_socket 97 /* Common */ @@ -123,14 +123,14 @@ #define __NR_rt_sigtimedwait 105 /* Linux Specific */ #define __NR_rt_sigqueueinfo 106 /* Linux Specific */ #define __NR_rt_sigsuspend 107 /* Linux Specific */ -#define __NR_sigvec 108 /* SunOS Specific */ -#define __NR_sigblock 109 /* SunOS Specific */ -#define __NR_sigsetmask 110 /* SunOS Specific */ -#define __NR_sigpause 111 /* SunOS Specific */ -#define __NR_sigstack 112 /* SunOS Specific */ +/* #define __NR_sigvec 108 SunOS Specific */ +/* #define __NR_sigblock 109 SunOS Specific */ +/* #define __NR_sigsetmask 110 SunOS Specific */ +/* #define __NR_sigpause 111 SunOS Specific */ +/* #define __NR_sigstack 112 SunOS Specific */ #define __NR_recvmsg 113 /* Common */ #define __NR_sendmsg 114 /* Common */ -#define __NR_vtrace 115 /* SunOS Specific */ +/* #define __NR_vtrace 115 SunOS Specific */ #define __NR_gettimeofday 116 /* Common */ #define __NR_getrusage 117 /* Common */ #define __NR_getsockopt 118 /* Common */ @@ -155,63 +155,63 @@ #define __NR_rmdir 137 /* Common */ #define __NR_utimes 138 /* SunOS Specific */ /* #define __NR_ni_syscall 139 ENOSYS under SunOS */ -#define __NR_adjtime 140 /* SunOS Specific */ +/* #define __NR_adjtime 140 SunOS Specific */ #define __NR_getpeername 141 /* Common */ -#define __NR_gethostid 142 /* SunOS Specific */ +/* #define __NR_gethostid 142 SunOS Specific */ /* #define __NR_ni_syscall 143 ENOSYS under SunOS */ #define __NR_getrlimit 144 /* Common */ #define __NR_setrlimit 145 /* Common */ -#define __NR_killpg 146 /* SunOS Specific */ +/* #define __NR_killpg 146 SunOS Specific */ #define __NR_prctl 147 /* ENOSYS under SunOS */ #define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ #define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ #define __NR_getsockname 150 /* Common */ -#define __NR_getmsg 151 /* SunOS Specific */ -#define __NR_putmsg 152 /* SunOS Specific */ -#define __NR_poll 153 /* SunOS Specific */ +/* #define __NR_getmsg 151 SunOS Specific */ +/* #define __NR_putmsg 152 SunOS Specific */ +#define __NR_poll 153 /* Common */ /* #define __NR_ni_syscall 154 ENOSYS under SunOS */ -#define __NR_nfssvc 155 /* SunOS Specific */ -#define __NR_getdirentries 156 /* SunOS Specific */ +/* #define __NR_nfssvc 155 SunOS Specific */ +/* #define __NR_getdirentries 156 SunOS Specific */ #define __NR_statfs 157 /* Common */ #define __NR_fstatfs 158 /* Common */ #define __NR_umount 159 /* Common */ -#define __NR_async_daemon 160 /* SunOS Specific */ -#define __NR_getfh 161 /* SunOS Specific */ +/* #define __NR_async_daemon 160 SunOS Specific */ +/* #define __NR_getfh 161 SunOS Specific */ #define __NR_getdomainname 162 /* SunOS Specific */ #define __NR_setdomainname 163 /* Common */ #define __NR_utrap_install 164 /* SYSV ABI/v9 required */ #define __NR_quotactl 165 /* Common */ -#define __NR_exportfs 166 /* SunOS Specific */ +/* #define __NR_exportfs 166 SunOS Specific */ #define __NR_mount 167 /* Common */ #define __NR_ustat 168 /* Common */ -#define __NR_semsys 169 /* SunOS Specific */ -#define __NR_msgsys 170 /* SunOS Specific */ -#define __NR_shmsys 171 /* SunOS Specific */ -#define __NR_auditsys 172 /* SunOS Specific */ -#define __NR_rfssys 173 /* SunOS Specific */ +/* #define __NR_semsys 169 SunOS Specific */ +/* #define __NR_msgsys 170 SunOS Specific */ +/* #define __NR_shmsys 171 SunOS Specific */ +/* #define __NR_auditsys 172 SunOS Specific */ +/* #define __NR_rfssys 173 SunOS Specific */ #define __NR_getdents 174 /* Common */ #define __NR_setsid 175 /* Common */ #define __NR_fchdir 176 /* Common */ -#define __NR_fchroot 177 /* SunOS Specific */ -#define __NR_vpixsys 178 /* SunOS Specific */ -#define __NR_aioread 179 /* SunOS Specific */ -#define __NR_aiowrite 180 /* SunOS Specific */ -#define __NR_aiowait 181 /* SunOS Specific */ -#define __NR_aiocancel 182 /* SunOS Specific */ +/* #define __NR_fchroot 177 SunOS Specific */ +/* #define __NR_vpixsys 178 SunOS Specific */ +/* #define __NR_aioread 179 SunOS Specific */ +/* #define __NR_aiowrite 180 SunOS Specific */ +/* #define __NR_aiowait 181 SunOS Specific */ +/* #define __NR_aiocancel 182 SunOS Specific */ #define __NR_sigpending 183 /* Common */ #define __NR_query_module 184 /* Linux Specific */ #define __NR_setpgid 185 /* Common */ -#define __NR_pathconf 186 /* SunOS Specific */ -#define __NR_fpathconf 187 /* SunOS Specific */ -#define __NR_sysconf 188 /* SunOS Specific */ +/* #define __NR_pathconf 186 SunOS Specific */ +/* #define __NR_fpathconf 187 SunOS Specific */ +/* #define __NR_sysconf 188 SunOS Specific */ #define __NR_uname 189 /* Linux Specific */ #define __NR_init_module 190 /* Linux Specific */ #define __NR_personality 191 /* Linux Specific */ -#define __NR_prof 192 /* Linux Specific */ -#define __NR_break 193 /* Linux Specific */ -#define __NR_lock 194 /* Linux Specific */ -#define __NR_mpx 195 /* Linux Specific */ -#define __NR_ulimit 196 /* Linux Specific */ +/* #define __NR_prof 192 Linux Specific */ +/* #define __NR_break 193 Linux Specific */ +/* #define __NR_lock 194 Linux Specific */ +/* #define __NR_mpx 195 Linux Specific */ +/* #define __NR_ulimit 196 Linux Specific */ #define __NR_getppid 197 /* Linux Specific */ #define __NR_sigaction 198 /* Linux Specific */ #define __NR_sgetmask 199 /* Linux Specific */ @@ -220,20 +220,20 @@ #define __NR_oldlstat 202 /* Linux Specific */ #define __NR_uselib 203 /* Linux Specific */ #define __NR_readdir 204 /* Linux Specific */ -#define __NR_ioperm 205 /* Linux Specific - i386 specific, unused */ +/* #define __NR_ioperm 205 Linux Specific - i386 specific, unused */ #define __NR_socketcall 206 /* Linux Specific */ #define __NR_syslog 207 /* Linux Specific */ -#define __NR_olduname 208 /* Linux Specific */ -#define __NR_iopl 209 /* Linux Specific - i386 specific, unused */ +/* #define __NR_olduname 208 Linux Specific */ +/* #define __NR_iopl 209 Linux Specific - i386 specific, unused */ #define __NR_idle 210 /* Linux Specific */ -#define __NR_vm86 211 /* Linux Specific - i386 specific, unused */ +/* #define __NR_vm86 211 Linux Specific - i386 specific, unused */ #define __NR_waitpid 212 /* Linux Specific */ #define __NR_swapoff 213 /* Linux Specific */ #define __NR_sysinfo 214 /* Linux Specific */ #define __NR_ipc 215 /* Linux Specific */ #define __NR_sigreturn 216 /* Linux Specific */ #define __NR_clone 217 /* Linux Specific */ -#define __NR_modify_ldt 218 /* Linux Specific - i386 specific, unused */ +/* #define __NR_modify_ldt 218 Linux Specific - i386 specific, unused */ #define __NR_adjtimex 219 /* Linux Specific */ #define __NR_sigprocmask 220 /* Linux Specific */ #define __NR_create_module 221 /* Linux Specific */ @@ -247,10 +247,10 @@ #define __NR_setfsgid 229 /* Linux Specific */ #define __NR__newselect 230 /* Linux Specific */ #define __NR_time 231 /* Linux Specific */ -#define __NR_oldstat 232 /* Linux Specific */ +/* #define __NR_oldstat 232 Linux Specific */ #define __NR_stime 233 /* Linux Specific */ -#define __NR_oldfstat 234 /* Linux Specific */ -#define __NR_phys 235 /* Linux Specific */ +/* #define __NR_oldfstat 234 Linux Specific */ +/* #define __NR_phys 235 Linux Specific */ #define __NR__llseek 236 /* Linux Specific */ #define __NR_mlock 237 #define __NR_munlock 238 @@ -417,6 +417,7 @@ static __inline__ _syscall0(int,sync) static __inline__ _syscall0(pid_t,setsid) static __inline__ _syscall3(int,write,int,fd,__const__ char *,buf,off_t,count) static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count) +static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) static __inline__ _syscall1(int,dup,int,fd) static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp) static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode) @@ -430,70 +431,7 @@ static __inline__ pid_t wait(int * wait_stat) return waitpid(-1,wait_stat,0); } -/* - * This is the mechanism for creating a new kernel thread. - * - * NOTE! Only a kernel-only process(ie the swapper or direct descendants - * who haven't done an "execve()") should use this: it will work within - * a system call from a "real" process, but the process memory space will - * not be free'd until both the parent and the child have exited. - */ -static __inline__ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - long retval; - - __asm__ __volatile("mov %1, %%g1\n\t" - "mov %2, %%o0\n\t" /* Clone flags. */ - "mov 0, %%o1\n\t" /* usp arg == 0 */ - "t 0x6d\n\t" /* Linux/Sparc clone(). */ - "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */ - " mov %%o0, %0\n\t" - "jmpl %4, %%o7\n\t" /* Call the function. */ - " mov %5, %%o0\n\t" /* Set arg in delay. */ - "mov %3, %%g1\n\t" - "t 0x6d\n\t" /* Linux/Sparc exit(). */ - /* Notreached by child. */ - "1:" : - "=r" (retval) : - "i" (__NR_clone), "r" (flags | CLONE_VM), - "i" (__NR_exit), "r" (fn), "r" (arg) : - "g1", "o0", "o1", "memory", "cc"); - return retval; -} - -static __inline__ pid_t fork(void) -{ - long retval; - - __asm__ __volatile("mov %1, %%g1\n\t" - "t 0x6d\n\t" - "brz,a,pn %%o1, 1f\n\t" - " mov %%o0, %0\n\t" - "mov %%g0, %0\n\t" - "1:" : - "=r" (retval) : - "i" (__NR_fork) : - "g1", "o0", "o1", "memory", "cc"); - return retval; -} - -static __inline__ pid_t clone(unsigned long flags, char *ksp) -{ - long retval; - - __asm__ __volatile("mov %1, %%g1\n\t" - "mov %2, %%o0\n\t" - "mov %3, %%o1\n\t" - "t 0x6d\n\t" - "brz,a,pn %%o1, 1f\n\t" - " mov %%o0, %0\n\t" - "mov %%g0, %0\n\t" - "1:" : - "=r" (retval) : - "i" (__NR_fork), "r" (flags), "r" (ksp) : - "g1", "o0", "o1", "memory", "cc"); - return retval; -} +extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #endif /* __KERNEL_SYSCALLS__ */ diff --git a/include/asm-sparc64/vga.h b/include/asm-sparc64/vga.h index 14ae757a4..b637522eb 100644 --- a/include/asm-sparc64/vga.h +++ b/include/asm-sparc64/vga.h @@ -17,7 +17,7 @@ static inline void scr_writew(u16 val, u16 *addr) writew(val, (unsigned long) addr); } -static inline u16 scr_readw(u16 *addr) +static inline u16 scr_readw(const u16 *addr) { if ((long) addr < 0) return *addr; diff --git a/include/asm-sparc64/visasm.h b/include/asm-sparc64/visasm.h index 2cf9e320c..175549c93 100644 --- a/include/asm-sparc64/visasm.h +++ b/include/asm-sparc64/visasm.h @@ -1,4 +1,4 @@ -/* $Id: visasm.h,v 1.3 1998/09/04 01:59:48 ecd Exp $ */ +/* $Id: visasm.h,v 1.4 1999/04/19 01:25:55 davem Exp $ */ #ifndef _SPARC64_VISASM_H #define _SPARC64_VISASM_H @@ -10,7 +10,7 @@ #include <asm/pstate.h> #include <asm/ptrace.h> -#define AOFF_task_fpregs (((ASIZ_task) + 255) & ~255) +#define AOFF_task_fpregs (((ASIZ_task) + (64 - 1)) & ~(64 - 1)) /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */ diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h index fe4e79e4b..f6ed2d3b1 100644 --- a/include/linux/adfs_fs.h +++ b/include/linux/adfs_fs.h @@ -155,7 +155,7 @@ extern void adfs_read_inode (struct inode *inode); extern int adfs_map_lookup (struct super_block *sb, int frag_id, int offset); /* namei.c */ -extern int adfs_lookup (struct inode *dir, struct dentry *dentry); +extern struct dentry *adfs_lookup (struct inode *dir, struct dentry *dentry); /* super.c */ extern int init_adfs_fs (void); diff --git a/include/linux/adfs_fs_sb.h b/include/linux/adfs_fs_sb.h index 527c29fb6..649b61e45 100644 --- a/include/linux/adfs_fs_sb.h +++ b/include/linux/adfs_fs_sb.h @@ -15,6 +15,10 @@ struct adfs_sb_info { struct buffer_head *s_sbh; /* buffer head containing disc record */ struct adfs_discrecord *s_dr; /* pointer to disc record in s_sbh */ + uid_t s_uid; /* owner uid */ + gid_t s_gid; /* owner gid */ + int s_owner_mask; /* ADFS Owner perm -> unix perm */ + int s_other_mask; /* ADFS Other perm -> unix perm */ __u16 s_zone_size; /* size of a map zone in bits */ __u16 s_ids_per_zone; /* max. no ids in one zone */ __u32 s_idlen; /* length of ID in map */ diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h index 6361a82a1..342ac2648 100644 --- a/include/linux/affs_fs.h +++ b/include/linux/affs_fs.h @@ -60,7 +60,7 @@ extern void affs_make_zones(struct super_block *sb); /* namei.c */ extern int affs_hash_name(const unsigned char *name, int len, int intl, int hashsize); -extern int affs_lookup(struct inode *dir, struct dentry *dentry); +extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry); extern int affs_unlink(struct inode *dir, struct dentry *dentry); extern int affs_create(struct inode *dir, struct dentry *dentry, int mode); extern int affs_mkdir(struct inode *dir, struct dentry *dentry, int mode); diff --git a/include/linux/awe_voice.h b/include/linux/awe_voice.h index 95fc207da..aed60f5c2 100644 --- a/include/linux/awe_voice.h +++ b/include/linux/awe_voice.h @@ -3,9 +3,9 @@ * * Voice information definitions for the low level driver for the * AWE32/SB32/AWE64 wave table synth. - * version 0.4.3; Mar. 1, 1998 + * version 0.4.3; Feb. 1, 1999 * - * Copyright (C) 1996-1998 Takashi Iwai + * Copyright (C) 1996-1999 Takashi Iwai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,7 +133,7 @@ typedef struct _awe_voice_parm_block { unsigned short moddelay; /* modulation delay (0x8000) */ unsigned char modatk, modhld; unsigned char moddcy, modsus; - unsigned short modrel, moddummy; + unsigned char modrel, moddummy; short modkeyhold, modkeydecay; /* envelope change per key (not used) */ unsigned short voldelay; /* volume delay (0x8000) */ unsigned char volatk, volhld; diff --git a/include/linux/capability.h b/include/linux/capability.h index 07248ac5d..f6fb2c9c3 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -193,7 +193,6 @@ typedef __u32 kernel_cap_t; /* Allow device administration (mknod)*/ /* Allow examination and configuration of disk quotas */ /* Allow configuring the kernel's syslog (printk behaviour) */ -/* Allow sending a signal to any process */ /* Allow setting the domainname */ /* Allow setting the hostname */ /* Allow calling bdflush() */ diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index c63d79037..a8c028fb3 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -112,6 +112,9 @@ #define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ #define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ #define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ +#define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ +#define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ +#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ /* This ioctl is only used by sbpcd at the moment */ #define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ @@ -340,14 +343,15 @@ struct cdrom_blk #define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */ #define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ -/* drive status possibilities used with the uniform CD-ROM driver */ -#define CDS_NO_INFO 0 /* if not implemented */ +/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ +#define CDS_NO_INFO 0 /* if not implemented */ #define CDS_NO_DISC 1 #define CDS_TRAY_OPEN 2 #define CDS_DRIVE_NOT_READY 3 #define CDS_DISC_OK 4 -/* disc status possibilities, other than CDS_NO_DISC and CDS_NO_INFO */ +/* return values for the CDROM_DISC_STATUS ioctl */ +/* can also return CDS_NO_[INFO|DISC], from above */ #define CDS_AUDIO 100 #define CDS_DATA_1 101 #define CDS_DATA_2 102 diff --git a/include/linux/console.h b/include/linux/console.h index 35bc9984b..6df950101 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -42,6 +42,8 @@ struct consw { void (*con_save_screen)(struct vc_data *); u8 (*con_build_attr)(struct vc_data *, u8, u8, u8, u8, u8); void (*con_invert_region)(struct vc_data *, u16 *, int); + u16 *(*con_screen_pos)(struct vc_data *, int); + unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *); }; extern struct consw *conswitchp; diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h index 6e67b5414..0f373ff5b 100644 --- a/include/linux/cyclades.h +++ b/include/linux/cyclades.h @@ -316,6 +316,7 @@ struct FIRM_ID { #define C_IN_OVR_ERROR 0x00008000 /* overrun error */ #define C_IN_RXOFL 0x00010000 /* RX buffer overflow */ #define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */ +#define C_IN_MRTS 0x00040000 /* modem RTS drop */ /* flow control */ @@ -332,12 +333,14 @@ struct FIRM_ID { /* rs_control/rs_status RS-232 signals */ +#define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in + IOCTLM command */ +#define C_RS_RTS 0x00000001 /* RTS */ +#define C_RS_DTR 0x00000004 /* DTR */ #define C_RS_DCD 0x00000100 /* CD */ #define C_RS_DSR 0x00000200 /* DSR */ #define C_RS_RI 0x00000400 /* RI */ #define C_RS_CTS 0x00000800 /* CTS */ -#define C_RS_RTS 0x00000001 /* RTS */ -#define C_RS_DTR 0x00000004 /* DTR */ /* commands Host <-> Board */ @@ -353,13 +356,18 @@ struct FIRM_ID { #define C_CM_SET_BREAK 0x43 /* Tx break on */ #define C_CM_CLR_BREAK 0x44 /* Tx break off */ #define C_CM_CMD_DONE 0x45 /* Previous command done */ +#define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */ #define C_CM_TINACT 0x51 /* set inactivity detection */ #define C_CM_IRQ_ENBL 0x52 /* enable generation of interrupts */ #define C_CM_IRQ_DSBL 0x53 /* disable generation of interrupts */ -#define C_CM_ACK_ENBL 0x54 /* enable acknolowdged interrupt mode */ -#define C_CM_ACK_DSBL 0x55 /* disable acknolowdged intr mode */ +#define C_CM_ACK_ENBL 0x54 /* enable acknowledged interrupt mode */ +#define C_CM_ACK_DSBL 0x55 /* disable acknowledged intr mode */ #define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */ #define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */ +#define C_CM_Q_ENABLE 0x58 /* enables queue access from the + driver */ +#define C_CM_Q_DISABLE 0x59 /* disables queue access from the + driver */ #define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */ #define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */ @@ -369,6 +377,7 @@ struct FIRM_ID { #define C_CM_MDSR 0x71 /* modem DSR change */ #define C_CM_MRI 0x72 /* modem RI change */ #define C_CM_MCTS 0x73 /* modem CTS change */ +#define C_CM_MRTS 0x74 /* modem RTS drop */ #define C_CM_RXBRK 0x84 /* Break received */ #define C_CM_PR_ERROR 0x85 /* Parity error */ #define C_CM_FR_ERROR 0x86 /* Frame error */ @@ -449,9 +458,22 @@ struct BOARD_CTRL { /* FW to Host commands */ uclong fwcmd_channel; /* channel number */ uclong fwcmd_param; /* pointer to parameters */ + uclong zf_int_queue_addr; /* offset for INT_QUEUE structure */ /* filler so the structures are aligned */ - uclong filler[7]; + uclong filler[6]; +}; + +/* Host Interrupt Queue */ + +#define QUEUE_SIZE (10*MAX_CHAN) + +struct INT_QUEUE { + unsigned char intr_code[QUEUE_SIZE]; + unsigned long channel[QUEUE_SIZE]; + unsigned long param[QUEUE_SIZE]; + unsigned long put; + unsigned long get; }; /* @@ -586,6 +608,8 @@ struct cyclades_port { #define CyPCI_Zwin 0x80000 #define CyPCI_Ze_win (2 * CyPCI_Zwin) +#define PCI_DEVICE_ID_MASK 0x06 + /**** CD1400 registers ****/ #define CD1400_REV_G 0x46 diff --git a/include/linux/dcache.h b/include/linux/dcache.h index ecf38fd06..84e1376b3 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -6,7 +6,10 @@ /* * linux/include/linux/dcache.h * - * Directory cache data structures + * Dirent cache data structures + * + * (C) Copyright 1997 Thomas Schoebel-Theuer, + * with heavy changes by Linus Torvalds */ #define D_MAXLEN 1024 @@ -74,7 +77,7 @@ struct dentry { }; struct dentry_operations { - int (*d_revalidate)(struct dentry *); + int (*d_revalidate)(struct dentry *, int); int (*d_hash) (struct dentry *, struct qstr *); int (*d_compare) (struct dentry *, struct qstr *, struct qstr *); void (*d_delete)(struct dentry *); diff --git a/include/linux/dtlk.h b/include/linux/dtlk.h new file mode 100644 index 000000000..07a6b82bc --- /dev/null +++ b/include/linux/dtlk.h @@ -0,0 +1,104 @@ +#if 0 + +#define TRACE_TXT(text) \ + { \ + if(dtlk_trace) \ + { \ + console_print(text); \ + console_print("\n"); \ + } \ + } + +#define TRACE_CHR(chr) \ + { \ + if(dtlk_trace) \ + console_print(chr); \ + } \ + +#endif + +#define DTLK_MINOR 0 +#define DTLK_IO_EXTENT 0x02 + + /* ioctl's use magic number of 0xa3 */ +#define DTLK_INTERROGATE 0xa390 /* get settings from the DoubleTalk */ +#define DTLK_STATUS 0xa391 /* get status from the DoubleTalk */ + + +#define DTLK_CLEAR 0x18 /* stops speech */ + +#define DTLK_MAX_RETRIES (loops_per_sec/10000) + + /* TTS Port Status Flags */ +#define TTS_READABLE 0x80 /* mask for bit which is nonzero if a + byte can be read from the TTS port */ +#define TTS_SPEAKING 0x40 /* mask for SYNC bit, which is nonzero + while DoubleTalk is producing + output with TTS, PCM or CVSD + synthesizers or tone generators + (that is, all but LPC) */ +#define TTS_SPEAKING2 0x20 /* mask for SYNC2 bit, + which falls to zero up to 0.4 sec + before speech stops */ +#define TTS_WRITABLE 0x10 /* mask for RDY bit, which when set to + 1, indicates the TTS port is ready + to accept a byte of data. The RDY + bit goes zero 2-3 usec after + writing, and goes 1 again 180-190 + usec later. */ +#define TTS_ALMOST_FULL 0x08 /* mask for AF bit: When set to 1, + indicates that less than 300 free + bytes are available in the TTS + input buffer. AF is always 0 in the + PCM, TGN and CVSD modes. */ +#define TTS_ALMOST_EMPTY 0x04 /* mask for AE bit: When set to 1, + indicates that less than 300 bytes + of data remain in DoubleTalk's + input (TTS or PCM) buffer. AE is + always 1 in the TGN and CVSD + modes. */ + + /* LPC speak commands */ +#define LPC_5220_NORMAL 0x60 /* 5220 format decoding table, normal rate */ +#define LPC_5220_FAST 0x64 /* 5220 format decoding table, fast rate */ +#define LPC_D6_NORMAL 0x20 /* D6 format decoding table, normal rate */ +#define LPC_D6_FAST 0x24 /* D6 format decoding table, fast rate */ + + /* LPC Port Status Flags (valid only after one of the LPC + speak commands) */ +#define LPC_SPEAKING 0x80 /* mask for TS bit: When set to 1, + indicates the LPC synthesizer is + producing speech.*/ +#define LPC_BUFFER_LOW 0x40 /* mask for BL bit: When set to 1, + indicates that the hardware LPC + data buffer has less than 30 bytes + remaining. (Total internal buffer + size = 4096 bytes.) */ +#define LPC_BUFFER_EMPTY 0x20 /* mask for BE bit: When set to 1, + indicates that the LPC data buffer + ran out of data (error condition if + TS is also 1). */ + + /* data returned by Interrogate command */ +struct dtlk_settings +{ + unsigned short serial_number; /* 0-7Fh:0-7Fh */ + unsigned char rom_version[24]; /* null terminated string */ + unsigned char mode; /* 0=Character; 1=Phoneme; 2=Text */ + unsigned char punc_level; /* nB; 0-7 */ + unsigned char formant_freq; /* nF; 0-9 */ + unsigned char pitch; /* nP; 0-99 */ + unsigned char speed; /* nS; 0-9 */ + unsigned char volume; /* nV; 0-9 */ + unsigned char tone; /* nX; 0-2 */ + unsigned char expression; /* nE; 0-9 */ + unsigned char ext_dict_loaded; /* 1=exception dictionary loaded */ + unsigned char ext_dict_status; /* 1=exception dictionary enabled */ + unsigned char free_ram; /* # pages (truncated) remaining for + text buffer */ + unsigned char articulation; /* nA; 0-9 */ + unsigned char reverb; /* nR; 0-9 */ + unsigned char eob; /* 7Fh value indicating end of + parameter block */ + unsigned char has_indexing; /* nonzero if indexing is implemented */ +}; diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 96b1d1955..b1352dc02 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -572,7 +572,7 @@ extern int ext2_ioctl (struct inode *, struct file *, unsigned int, /* namei.c */ extern void ext2_release (struct inode *, struct file *); -extern int ext2_lookup (struct inode *, struct dentry *); +extern struct dentry *ext2_lookup (struct inode *, struct dentry *); extern int ext2_create (struct inode *,struct dentry *,int); extern int ext2_mkdir (struct inode *,struct dentry *,int); extern int ext2_rmdir (struct inode *,struct dentry *); diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h index 9ce758116..207216323 100644 --- a/include/linux/ext2_fs_sb.h +++ b/include/linux/ext2_fs_sb.h @@ -49,8 +49,6 @@ struct ext2_sb_info { struct buffer_head * s_inode_bitmap[EXT2_MAX_GROUP_LOADED]; unsigned long s_block_bitmap_number[EXT2_MAX_GROUP_LOADED]; struct buffer_head * s_block_bitmap[EXT2_MAX_GROUP_LOADED]; - int s_rename_lock; - struct wait_queue * s_rename_wait; unsigned long s_mount_opt; unsigned short s_resuid; unsigned short s_resgid; diff --git a/include/linux/fb.h b/include/linux/fb.h index f4c775db4..f084ca036 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -31,6 +31,7 @@ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ #define FB_TYPE_TEXT 3 /* Text/attributes */ +#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ #define FB_AUX_TEXT_MDA 0 /* Monochrome text */ #define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ @@ -67,6 +68,10 @@ #define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */ #define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */ #define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */ +#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */ +#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */ +#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */ +#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */ struct fb_fix_screeninfo { char id[16]; /* identification string eg "TT Builtin" */ @@ -232,6 +237,8 @@ struct fb_ops { unsigned long arg, int con, struct fb_info *info); /* perform fb specific mmap */ int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); + /* switch to/from raster image mode */ + int (*fb_rasterimg)(struct fb_info *info, int start); }; @@ -291,7 +298,7 @@ struct display { struct fb_info { char modename[40]; /* default video mode */ - int node; + kdev_t node; int flags; #define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */ struct fb_ops *fbops; @@ -340,8 +347,8 @@ struct fbgen_hwswitch { int (*pan_display)(const struct fb_var_screeninfo *var, struct fb_info_gen *info); int (*blank)(int blank_mode, struct fb_info_gen *info); - void (*set_dispsw)(const void *par, struct display *disp, - struct fb_info_gen *info); + void (*set_disp)(const void *par, struct display *disp, + struct fb_info_gen *info); }; struct fb_info_gen { diff --git a/include/linux/filter.h b/include/linux/filter.h index dcf33554e..58ad8b1bc 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -18,18 +18,32 @@ struct sock_filter /* Filter block */ { - u16 code; /* Actual filter code */ - u8 jt; /* Jump true */ - u8 jf; /* Jump false */ - u32 k; /* Generic multiuse field */ + __u16 code; /* Actual filter code */ + __u8 jt; /* Jump true */ + __u8 jf; /* Jump false */ + __u32 k; /* Generic multiuse field */ }; struct sock_fprog /* Required for SO_ATTACH_FILTER. */ { - unsigned short len; /* Number of filter blocks */ - struct sock_filter *filter; + unsigned short len; /* Number of filter blocks */ + struct sock_filter *filter; }; +#ifdef __KERNEL__ +struct sk_filter +{ + atomic_t refcnt; + unsigned int len; /* Number of filter blocks */ + struct sock_filter insns[0]; +}; + +extern __inline__ unsigned int sk_filter_len(struct sk_filter *fp) +{ + return fp->len*sizeof(struct sock_filter) + sizeof(*fp); +} +#endif + /* * Instruction classes */ @@ -86,21 +100,40 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */ #define BPF_TAX 0x00 #define BPF_TXA 0x80 -#define BPF_MAXINSNS 512 +#ifndef BPF_MAXINSNS +#define BPF_MAXINSNS 4096 +#endif /* * Macros for filter block array initializers. */ +#ifndef BPF_STMT #define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } +#endif +#ifndef BPF_JUMP #define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } +#endif /* * Number of scratch memory words for: BPF_ST and BPF_STX */ #define BPF_MEMWORDS 16 +/* RATIONALE. Negative offsets are invalid in BPF. + We use them to reference ancillary data. + Unlike introduction new instructions, it does not break + existing compilers/optimizers. + */ +#define SKF_AD_OFF (-0x1000) +#define SKF_AD_PROTOCOL 0 +#define SKF_AD_PKTTYPE 4 +#define SKF_AD_IFINDEX 8 +#define SKF_AD_MAX 12 +#define SKF_NET_OFF (-0x100000) +#define SKF_LL_OFF (-0x200000) + #ifdef __KERNEL__ -extern int sk_run_filter(unsigned char *data, int len, struct sock_filter *filter, int flen); +extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); #endif /* __KERNEL__ */ diff --git a/include/linux/fs.h b/include/linux/fs.h index ff6e28dc5..e4ea5197f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -96,6 +96,10 @@ extern int max_super_blocks, nr_super_blocks; #define MS_NOATIME 1024 /* Do not update access times. */ #define MS_NODIRATIME 2048 /* Do not update directory access times */ +#define MS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon + * as nfs_rename() will be cleaned up + */ + /* * Flags that can be altered by MS_REMOUNT */ @@ -150,6 +154,7 @@ extern int max_super_blocks, nr_super_blocks; #define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ #define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ #define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ +#define BLKSSZGET _IO(0x12,104)/* get block device sector size (reserved for) */ #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ @@ -164,7 +169,7 @@ extern int max_super_blocks, nr_super_blocks; extern void update_atime (struct inode *inode); #define UPDATE_ATIME(inode) update_atime (inode) -extern void buffer_init(void); +extern void buffer_init(unsigned long); extern void inode_init(void); extern void file_table_init(void); extern void dcache_init(void); @@ -249,18 +254,8 @@ static inline int buffer_protected(struct buffer_head * bh) return test_bit(BH_Protected, &bh->b_state); } -/* - * Deprecated - we don't keep per-buffer reference flags - * any more. - * - * We _could_ try to update the page reference, but that - * doesn't seem to really be worth it either. If we did, - * it would look something like this: - * - * #define buffer_page(bh) (mem_map + MAP_NR((bh)->b_data)) - * #define touch_buffer(bh) set_bit(PG_referenced, &buffer_page(bh)->flags) - */ -#define touch_buffer(bh) do { } while (0) +#define buffer_page(bh) (mem_map + MAP_NR((bh)->b_data)) +#define touch_buffer(bh) set_bit(PG_referenced, &buffer_page(bh)->flags) #include <linux/pipe_fs_i.h> #include <linux/minix_fs_i.h> @@ -373,6 +368,7 @@ struct inode { int i_writecount; unsigned int i_attr_flags; + __u32 i_generation; union { struct pipe_inode_info pipe_i; struct minix_inode_info minix_i; @@ -425,6 +421,8 @@ struct file { unsigned int f_count, f_flags; unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin; struct fown_struct f_owner; + unsigned int f_uid, f_gid; + int f_error; unsigned long f_version; @@ -560,6 +558,11 @@ struct super_block { struct qnx4_sb_info qnx4_sb; void *generic_sbp; } u; + /* + * The next field is for VFS *only*. No filesystems have any business + * even looking at it. You had been warned. + */ + struct semaphore s_vfs_rename_sem; /* Kludge */ }; /* @@ -598,7 +601,7 @@ struct file_operations { struct inode_operations { struct file_operations * default_file_ops; int (*create) (struct inode *,struct dentry *,int); - int (*lookup) (struct inode *,struct dentry *); + struct dentry * (*lookup) (struct inode *,struct dentry *); int (*link) (struct dentry *,struct inode *,struct dentry *); int (*unlink) (struct inode *,struct dentry *); int (*symlink) (struct inode *,struct dentry *,const char *); @@ -695,8 +698,9 @@ asmlinkage int sys_close(unsigned int); /* yes, it's really unsigned */ extern int do_truncate(struct dentry *, unsigned long); extern int get_unused_fd(void); extern void put_unused_fd(unsigned int); -extern int close_fp(struct file *, fl_owner_t id); + extern struct file *filp_open(const char *, int, int); +extern int filp_close(struct file *, fl_owner_t id); extern char * getname(const char * filename); #define __getname() ((char *) __get_free_page(GFP_KERNEL)) @@ -810,6 +814,18 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *); #define PTR_ERR(ptr) ((long)(ptr)) #define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)(-1000)) +/* + * The bitmask for a lookup event: + * - follow links at the end + * - require a directory + * - ending slashes ok even for nonexistent files + * - internal "there are more path compnents" flag + */ +#define LOOKUP_FOLLOW (1) +#define LOOKUP_DIRECTORY (2) +#define LOOKUP_SLASHOK (4) +#define LOOKUP_CONTINUE (8) + extern struct dentry * lookup_dentry(const char *, struct dentry *, unsigned int); extern struct dentry * __namei(const char *, unsigned int); diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 20589194f..fdd93a0b4 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -10,6 +10,7 @@ */ #include <linux/config.h> +#include <linux/types.h> #define CONFIG_MSDOS_PARTITION 1 diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h index f3b3310e3..e345a9d22 100644 --- a/include/linux/hippidevice.h +++ b/include/linux/hippidevice.h @@ -52,6 +52,7 @@ extern void hippi_net_init(void); void hippi_setup(struct device *dev); extern struct device *init_hippi_dev(struct device *, int); +extern void unregister_hipdev(struct device *dev); #endif #endif /* _LINUX_HIPPIDEVICE_H */ diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 30d8b8f0a..39007c8bf 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -66,6 +66,13 @@ #define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ #define ARPHRD_ECONET 782 /* Acorn Econet */ #define ARPHRD_IRDA 783 /* Linux/IR */ +/* ARP works differently on different FC media .. so */ +#define ARPHRD_FCPP 784 /* Point to point fibrechanel */ +#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */ +#define ARPHRD_FCPL 786 /* Fibrechannel public loop */ +#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ + /* 787->799 reserved for fibrechannel media types */ + /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index bb7a98db3..1d103bdca 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h @@ -1,4 +1,4 @@ -/* $Id: if_ppp.h,v 1.14 1998/07/07 04:27:33 paulus Exp $ */ +/* $Id: if_ppp.h,v 1.19 1999/03/31 06:07:57 paulus Exp $ */ /* * if_ppp.h - Point-to-Point Protocol definitions. @@ -21,7 +21,7 @@ */ /* - * ==FILEVERSION 980704== + * ==FILEVERSION 990331== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. @@ -35,19 +35,13 @@ #ifndef _IF_PPP_H_ #define _IF_PPP_H_ -#if defined(__linux__) -#include <linux/if.h> -#include <linux/ioctl.h> -#include <linux/ppp_defs.h> -#endif - /* * Packet sizes */ #define PPP_MTU 1500 /* Default MTU (size of Info field) */ #define PPP_MAXMRU 65000 /* Largest MRU we allow */ -#define PPP_VERSION "2.3.3" +#define PPP_VERSION "2.3.7" #define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */ #define PROTO_IPX 0x002b /* protocol numbers */ #define PROTO_DNA_RT 0x0027 /* DNA Routing */ @@ -73,7 +67,8 @@ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ -#define SC_MASK 0x0f0000ff /* bits that user can change */ +#define SC_SYNC 0x00200000 /* synchronous serial mode */ +#define SC_MASK 0x0f2000ff /* bits that user can change */ /* state bits */ #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ diff --git a/include/linux/if_pppvar.h b/include/linux/if_pppvar.h index 6fae4b94b..d6cd0c25b 100644 --- a/include/linux/if_pppvar.h +++ b/include/linux/if_pppvar.h @@ -42,7 +42,7 @@ */ /* - * ==FILEVERSION 990114== + * ==FILEVERSION 990325== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. @@ -89,6 +89,7 @@ struct ppp { __u8 escape; /* 0x20 if prev char was PPP_ESC */ __u8 toss; /* toss this frame */ volatile __u8 tty_pushing; /* internal state flag */ + volatile __u8 woke_up; /* internal state flag */ __u32 xmit_async_map[8]; /* 1 bit means that given control character is quoted on output*/ __u32 recv_async_map; /* 1 bit means that given control diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h index 57ffd730a..8a3cbce1b 100644 --- a/include/linux/if_shaper.h +++ b/include/linux/if_shaper.h @@ -23,7 +23,7 @@ struct shaper __u32 shapeclock; __u32 recovery; /* Time we can next clock a packet out on an empty queue */ - char locked; + unsigned long locked; struct device *dev; int (*hard_start_xmit) (struct sk_buff *skb, struct device *dev); diff --git a/include/linux/in.h b/include/linux/in.h index 0dc2231a4..8d6c8b5b6 100644 --- a/include/linux/in.h +++ b/include/linux/in.h @@ -80,7 +80,6 @@ struct in_addr { /* These need to appear somewhere around here */ #define IP_DEFAULT_MULTICAST_TTL 1 #define IP_DEFAULT_MULTICAST_LOOP 1 -#define IP_MAX_MEMBERSHIPS 20 /* Request struct for multicast socket ops */ diff --git a/include/linux/in6.h b/include/linux/in6.h index 50f9d2d72..4f31677b9 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h @@ -67,6 +67,33 @@ struct ipv6_mreq { int ipv6mr_ifindex; }; +struct in6_flowlabel_req +{ + struct in6_addr flr_dst; + __u32 flr_label; + __u8 flr_action; + __u8 flr_share; + __u16 flr_flags; + __u16 flr_expires; + __u16 flr_linger; + __u32 __flr_pad; + /* Options in format of IPV6_PKTOPTIONS */ +}; + +#define IPV6_FL_A_GET 0 +#define IPV6_FL_A_PUT 1 +#define IPV6_FL_A_RENEW 2 + +#define IPV6_FL_F_CREATE 1 +#define IPV6_FL_F_EXCL 2 + +#define IPV6_FL_S_NONE 0 +#define IPV6_FL_S_EXCL 1 +#define IPV6_FL_S_PROCESS 2 +#define IPV6_FL_S_USER 3 +#define IPV6_FL_S_ANY 255 + + /* * Bitmask constant declarations to help applications select out the * flow label and priority fields. @@ -75,9 +102,10 @@ struct ipv6_mreq { * sockaddr_in6 is in network byte order. */ -#define IPV6_FLOWINFO_FLOWLABEL 0x00ff -#define IPV6_FLOWINFO_PRIORITY 0x0f00 +#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff +#define IPV6_FLOWINFO_PRIORITY 0x0ff00000 +/* These defintions are obsolete */ #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 #define IPV6_PRIORITY_FILLER 0x0100 #define IPV6_PRIORITY_UNATTENDED 0x0200 @@ -129,6 +157,7 @@ struct ipv6_mreq { #define IPV6_HOPLIMIT 8 #define IPV6_NEXTHOP 9 #define IPV6_AUTHHDR 10 +#define IPV6_FLOWINFO 11 #if 0 /* Aliases for obsolete names */ @@ -158,4 +187,9 @@ struct ipv6_mreq { #define IPV6_PMTUDISC_WANT 1 #define IPV6_PMTUDISC_DO 2 +/* Flowlabel */ +#define IPV6_FLOWLABEL_MGR 32 +#define IPV6_FLOWINFO_SEND 33 + + #endif diff --git a/include/linux/irda.h b/include/linux/irda.h new file mode 100644 index 000000000..275d82fc9 --- /dev/null +++ b/include/linux/irda.h @@ -0,0 +1,120 @@ +/********************************************************************* + * + * Filename: irda.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Mon Mar 8 14:06:12 1999 + * Modified at: Mon Mar 22 14:14:54 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1999 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsø admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef KERNEL_IRDA_H +#define KERNEL_IRDA_H + +/* Hint bit positions for first hint byte */ +#define HINT_PNP 0x01 +#define HINT_PDA 0x02 +#define HINT_COMPUTER 0x04 +#define HINT_PRINTER 0x08 +#define HINT_MODEM 0x10 +#define HINT_FAX 0x20 +#define HINT_LAN 0x40 +#define HINT_EXTENSION 0x80 + +/* Hint bit positions for second hint byte (first extension byte) */ +#define HINT_TELEPHONY 0x01 +#define HINT_FILE_SERVER 0x02 +#define HINT_COMM 0x04 +#define HINT_MESSAGE 0x08 +#define HINT_HTTP 0x10 +#define HINT_OBEX 0x20 + +/* IrLMP character code values */ +#define CS_ASCII 0x00 +#define CS_ISO_8859_1 0x01 +#define CS_ISO_8859_2 0x02 +#define CS_ISO_8859_3 0x03 +#define CS_ISO_8859_4 0x04 +#define CS_ISO_8859_5 0x05 +#define CS_ISO_8859_6 0x06 +#define CS_ISO_8859_7 0x07 +#define CS_ISO_8859_8 0x08 +#define CS_ISO_8859_9 0x09 +#define CS_UNICODE 0xff + +#define SOL_IRLMP 266 /* Same as SOL_IRDA for now */ +#define SOL_IRTTP 266 /* Same as SOL_IRDA for now */ + +#define IRLMP_ENUMDEVICES 1 +#define IRLMP_IAS_SET 2 +#define IRLMP_IAS_QUERY 3 +#define IRLMP_DISCOVERY_MASK_SET 4 + +#define IRTTP_QOS_SET 5 +#define IRTTP_QOS_GET 6 +#define IRTTP_MAX_SDU_SIZE 7 + +#define IAS_MAX_STRING 256 +#define IAS_MAX_OCTET_STRING 1024 +#define IAS_MAX_CLASSNAME 64 +#define IAS_MAX_ATTRIBNAME 256 + +#define LSAP_ANY 0xff + +struct sockaddr_irda { + sa_family_t sir_family; /* AF_IRDA */ + unsigned char sir_lsap_sel; /* LSAP/TSAP selector */ + unsigned int sir_addr; /* Device address */ + char sir_name[25]; /* Usually <service>:IrDA:TinyTP */ +}; + +struct irda_device_info { + unsigned int saddr; /* Address of remote device */ + unsigned int daddr; /* Link where it was discovered */ + char info[22]; /* Description */ + unsigned char charset; /* Charset used for description */ + unsigned char hints[2]; /* Hint bits */ +}; + +struct irda_device_list { + unsigned int len; + struct irda_device_info dev[0]; +}; + +struct irda_ias_set { + char irda_class_name[IAS_MAX_CLASSNAME]; + char irda_attrib_name[IAS_MAX_ATTRIBNAME]; + unsigned int irda_attrib_type; + union { + unsigned int irda_attrib_int; + struct { + unsigned short len; + u_char OctetSeq[IAS_MAX_OCTET_STRING]; + } irda_attrib_octet_seq; + struct { + unsigned char len; + unsigned char charset; + unsigned char string[IAS_MAX_STRING]; + } irda_attrib_string; + } attribute; +}; + +#endif /* KERNEL_IRDA_H */ + + + + diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h index 30a14b169..0fcb4b822 100644 --- a/include/linux/iso_fs.h +++ b/include/linux/iso_fs.h @@ -189,7 +189,7 @@ int get_acorn_filename(struct iso_directory_record *, char *, struct inode *); extern int isofs_open(struct inode * inode, struct file * filp); extern void isofs_release(struct inode * inode, struct file * filp); -extern int isofs_lookup(struct inode * dir, struct dentry *); +extern struct dentry *isofs_lookup(struct inode * dir, struct dentry *); extern unsigned long isofs_count_free_inodes(struct super_block *sb); extern int isofs_new_block(int dev); extern int isofs_free_block(int dev, int block); diff --git a/include/linux/kbd_ll.h b/include/linux/kbd_ll.h index d83f9ea8a..02ebf8ec8 100644 --- a/include/linux/kbd_ll.h +++ b/include/linux/kbd_ll.h @@ -7,6 +7,6 @@ extern struct pt_regs *kbd_pt_regs; -void handle_scancode(unsigned char scancode); +void handle_scancode(unsigned char scancode, int down); #endif /* _KBD_LL_H */ diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 5c1d0e4cc..384e14689 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -145,7 +145,7 @@ void nlm_shutdown_hosts(void); * Server-side lock handling */ u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, - struct nlm_lock *, int, u32); + struct nlm_lock *, int, struct nlm_cookie *); u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *, struct nlm_lock *); diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index 631a8fba8..f397306c4 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h @@ -25,10 +25,21 @@ struct nlm_lock { }; /* + * NLM cookies. Technically they can be 1K, Nobody uses over 8 bytes + * however. + */ + +struct nlm_cookie +{ + unsigned char data[8]; + unsigned int len; +}; + +/* * Generic lockd arguments for all but sm_notify */ struct nlm_args { - u32 cookie; + struct nlm_cookie cookie; struct nlm_lock lock; u32 block; u32 reclaim; @@ -42,7 +53,7 @@ struct nlm_args { * Generic lockd result */ struct nlm_res { - u32 cookie; + struct nlm_cookie cookie; u32 status; struct nlm_lock lock; }; diff --git a/include/linux/mca.h b/include/linux/mca.h index 9dc61d00b..5b6a6ebf0 100644 --- a/include/linux/mca.h +++ b/include/linux/mca.h @@ -39,27 +39,27 @@ things. */ specify a starting slot beyond zero, to deal with detecting multiple devices. Returns MCA_NOTFOUND if id not found. Also checks the integrated adapters. */ -extern int mca_find_adapter( int id, int start ); -extern int mca_find_unused_adapter( int id, int start ); +extern int mca_find_adapter(int id, int start); +extern int mca_find_unused_adapter(int id, int start); /* adapter state info - returns 0 if no */ -extern int mca_isadapter( int slot ); -extern int mca_isenabled( int slot ); +extern int mca_isadapter(int slot); +extern int mca_isenabled(int slot); -extern int mca_is_adapter_used( int slot ); -extern int mca_mark_as_used( int slot ); -extern void mca_mark_as_unused( int slot ); +extern int mca_is_adapter_used(int slot); +extern int mca_mark_as_used(int slot); +extern void mca_mark_as_unused(int slot); /* gets a byte out of POS register (stored in memory) */ -extern unsigned char mca_read_stored_pos( int slot, int reg ); +extern unsigned char mca_read_stored_pos(int slot, int reg); /* This can be expanded later. Right now, it gives us a way of getting meaningful information into the MCA_info structure, so we can have a more interesting /proc/mca. */ -extern void mca_set_adapter_name( int slot, char* name ); -extern char* mca_get_adapter_name( int slot ); +extern void mca_set_adapter_name(int slot, char* name); +extern char* mca_get_adapter_name(int slot); /* This sets up an information callback for /proc/mca/slot?. The @@ -73,8 +73,8 @@ extern char* mca_get_adapter_name( int slot ); unregisters, thus preventing kernel crashes and other such nastiness. */ -typedef int (*MCA_ProcFn)( char* buf, int slot, void* dev ); -extern void mca_set_adapter_procfn( int slot, MCA_ProcFn, void* dev ); +typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev); +extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev); /* These routines actually mess with the hardware POS registers. They temporarily disable the device (and interrupts), so make sure you know @@ -88,13 +88,13 @@ limits. */ /* read a byte from the specified POS register. */ -extern unsigned char mca_read_pos( int slot, int reg ); +extern unsigned char mca_read_pos(int slot, int reg); /* write a byte to the specified POS register. */ -extern void mca_write_pos( int slot, int reg, unsigned char byte ); +extern void mca_write_pos(int slot, int reg, unsigned char byte); /* Should only be called by the NMI interrupt handler, this will do some fancy stuff to figure out what might have generated a NMI. */ -extern void mca_handle_nmi( void ); +extern void mca_handle_nmi(void); #endif /* _LINUX_MCA_H */ diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h index 3a0635946..4682ee56e 100644 --- a/include/linux/minix_fs.h +++ b/include/linux/minix_fs.h @@ -89,7 +89,7 @@ struct minix_dir_entry { #ifdef __KERNEL__ -extern int minix_lookup(struct inode * dir, struct dentry *dentry); +extern struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry); extern int minix_create(struct inode * dir, struct dentry *dentry, int mode); extern int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode); extern int minix_rmdir(struct inode * dir, struct dentry *dentry); diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index e3d5f237b..e04dc1b42 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -16,7 +16,7 @@ #define RTC_MINOR 135 #define SUN_OPENPROM_MINOR 139 #define NVRAM_MINOR 144 -#define RADIO_MINOR 152 +#define I2O_MINOR 166 #define MISC_DYNAMIC_MINOR 255 #define SGI_GRAPHICS_MINOR 146 diff --git a/include/linux/mm.h b/include/linux/mm.h index 2413bfedf..ed4eeca0c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -177,10 +177,12 @@ typedef struct page { (test_and_clear_bit(PG_swap_cache, &(page)->flags)) /* - * page->reserved denotes a page which must never be accessed (which + * Various page->flags bits: + * + * PG_reserved is set for a page which must never be accessed (which * may not even be present). * - * page->dma is set for those pages which lie in the range of + * PG_DMA is set for those pages which lie in the range of * physical addresses capable of carrying DMA transfers. * * Multiple processes may "see" the same page. E.g. for untouched @@ -204,8 +206,8 @@ typedef struct page { * The following discussion applies only to them. * * A page may belong to an inode's memory mapping. In this case, - * page->inode is the inode, and page->offset is the file offset - * of the page (not necessarily a multiple of PAGE_SIZE). + * page->inode is the pointer to the inode, and page->offset is the + * file offset of the page (not necessarily a multiple of PAGE_SIZE). * * A page may have buffers allocated to it. In this case, * page->buffers is a circular list of these buffer heads. Else, @@ -219,7 +221,7 @@ typedef struct page { * fields are also used for freelist management when page->count==0.) * There is also a hash table mapping (inode,offset) to the page * in memory if present. The lists for this hash table use the fields - * page->next_hash and page->prev_hash. + * page->next_hash and page->pprev_hash. * * All process pages can do I/O: * - inode pages may need to be read from disk, @@ -227,18 +229,23 @@ typedef struct page { * to be written to disk, * - private pages which have been modified may need to be swapped out * to swap space and (later) to be read back into memory. - * During disk I/O, page->locked is true. This bit is set before I/O + * During disk I/O, PG_locked is used. This bit is set before I/O * and reset when I/O completes. page->wait is a wait queue of all * tasks waiting for the I/O on this page to complete. - * page->uptodate tells whether the page's contents is valid. + * PG_uptodate tells whether the page's contents is valid. * When a read completes, the page becomes uptodate, unless a disk I/O * error happened. - * When a write completes, and page->free_after is true, the page is + * When a write completes, and PG_free_after is set, the page is * freed without any further delay. * * For choosing which pages to swap out, inode pages carry a - * page->referenced bit, which is set any time the system accesses + * PG_referenced bit, which is set any time the system accesses * that page through the (inode,offset) hash table. + * + * PG_skip is used on sparc/sparc64 architectures to "skip" certain + * parts of the address space. + * + * PG_error is set to indicate that an I/O error occurred on this page. */ extern mem_map_t * mem_map; @@ -351,11 +358,6 @@ extern void put_cached_page(unsigned long); #define GFP_LEVEL_MASK 0xf -/* - * Decide if we should try to do some swapout.. - */ -extern int free_memory_available(void); - /* vma is the first one with address < vma->vm_end, * and even address < vma->vm_start. Have to extend vma. */ static inline int expand_stack(struct vm_area_struct * vma, unsigned long address) diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index bcf4d0134..7e27f1ac6 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -195,7 +195,7 @@ struct fat_cache { }; /* misc.c */ -extern int is_binary(char conversion,char *extension); +extern int fat_is_binary(char conversion,char *extension); extern void lock_fat(struct super_block *sb); extern void unlock_fat(struct super_block *sb); extern int fat_add_cluster(struct inode *inode); @@ -271,7 +271,7 @@ extern struct super_block *msdos_read_super(struct super_block *sb,void *data, i /* msdos.c - these are for Umsdos */ extern void msdos_read_inode(struct inode *inode); -extern int msdos_lookup(struct inode *dir,struct dentry *); +extern struct dentry *msdos_lookup(struct inode *dir,struct dentry *); extern int msdos_create(struct inode *dir,struct dentry *dentry,int mode); extern int msdos_rmdir(struct inode *dir,struct dentry *dentry); extern int msdos_mkdir(struct inode *dir,struct dentry *dentry,int mode); @@ -312,7 +312,7 @@ extern void vfat_put_super(struct super_block *sb); extern struct super_block *vfat_read_super(struct super_block *sb,void *data, int silent); extern void vfat_read_inode(struct inode *inode); -extern int vfat_lookup(struct inode *dir,struct dentry *); +extern struct dentry *vfat_lookup(struct inode *dir,struct dentry *); /* vfat/vfatfs_syms.c */ extern struct file_system_type vfat_fs_type; diff --git a/include/linux/nbd.h b/include/linux/nbd.h index 45b060291..c2c0431f4 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h @@ -8,6 +8,7 @@ #define NBD_CLEAR_SOCK _IO( 0xab, 4 ) #define NBD_CLEAR_QUE _IO( 0xab, 5 ) #define NBD_PRINT_DEBUG _IO( 0xab, 6 ) +#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) #ifdef MAJOR_NR @@ -60,13 +61,21 @@ struct nbd_device { #define NBD_REPLY_MAGIC 0x67446698 /* Do *not* use magics: 0x12560953 0x96744668. */ +/* + * This is packet used for communication between client and + * server. All data are in network byte order. + */ struct nbd_request { u32 magic; u32 type; /* == READ || == WRITE */ char handle[8]; u64 from; u32 len; -}; +} +#ifdef __GNUC__ + __attribute__ ((packed)) +#endif +; struct nbd_reply { u32 magic; diff --git a/include/linux/ncp.h b/include/linux/ncp.h index 83ad3f723..666ffff0f 100644 --- a/include/linux/ncp.h +++ b/include/linux/ncp.h @@ -3,6 +3,7 @@ * * Copyright (C) 1995 by Volker Lendecke * Modified for sparc by J.F. Chadima + * Modified for __constant_ntoh by Frank A. Vorstenbosch * */ @@ -58,11 +59,21 @@ struct ncp_volume_info { /* these define the attribute byte as seen by NCP */ #define aRONLY (ntohl(0x01000000)) -#define aHIDDEN (ntohl(0x02000000)) -#define aSYSTEM (ntohl(0x04000000)) +#define aHIDDEN (__constant_ntohl(0x02000000)) +#define aSYSTEM (__constant_ntohl(0x04000000)) #define aEXECUTE (ntohl(0x08000000)) #define aDIR (ntohl(0x10000000)) #define aARCH (ntohl(0x20000000)) +#define aSHARED (ntohl(0x80000000)) +#define aDONTSUBALLOCATE (ntohl(1L<<(11+8))) +#define aTRANSACTIONAL (ntohl(1L<<(12+8))) +#define aPURGE (ntohl(1L<<(16-8))) +#define aRENAMEINHIBIT (ntohl(1L<<(17-8))) +#define aDELETEINHIBIT (ntohl(1L<<(18-8))) +#define aDONTCOMPRESS (nothl(1L<<(27-24))) + +#define NCP_MIN_SYMLINK_SIZE 8 +#define NCP_MAX_SYMLINK_SIZE 512 #define AR_READ (ntohs(0x0100)) #define AR_WRITE (ntohs(0x0200)) diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index eb83cfe01..b30fd0610 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h @@ -13,6 +13,15 @@ #include <linux/types.h> #include <linux/ncp_mount.h> + +/* NLS charsets by ioctl */ +#define NCP_IOCSNAME_LEN 20 +struct ncp_nls_ioctl +{ + unsigned char codepage[NCP_IOCSNAME_LEN+1]; + unsigned char iocharset[NCP_IOCSNAME_LEN+1]; +}; + #include <linux/ncp_fs_sb.h> #include <linux/ncp_fs_i.h> @@ -111,6 +120,9 @@ struct ncp_privatedata_ioctl #define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl) #define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl) +#define NCP_IOC_GETCHARSETS _IOWR('n', 11, struct ncp_nls_ioctl) +#define NCP_IOC_SETCHARSETS _IOR('n', 11, struct ncp_nls_ioctl) + /* * The packet size to allocate. One page should be enough. */ @@ -155,6 +167,12 @@ struct ncpfs_i { __u32 dirEntNum __attribute__((packed)); __u32 DosDirNum __attribute__((packed)); __u32 volNumber __attribute__((packed)); +#ifdef CONFIG_NCPFS_SMALLDOS + __u32 origNS; +#endif +#ifdef CONFIG_NCPFS_STRONG + __u32 nwattr; +#endif int opened; int access; __u32 server_file_handle __attribute__((packed)); @@ -272,11 +290,14 @@ static inline int ncp_namespace(struct inode *inode) return server->name_space[NCP_FINFO(inode)->volNumber]; } -static inline int ncp_preserve_case(struct inode *i) -{ +static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) { #if defined(CONFIG_NCPFS_NFS_NS) || defined(CONFIG_NCPFS_OS2_NS) int ns = ncp_namespace(i); #endif +#if defined(CONFIG_NCPFS_SMALLDOS) && defined(CONFIG_NCPFS_OS2_NS) + if ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS)) + return 0; +#endif return #ifdef CONFIG_NCPFS_OS2_NS (ns == NW_NS_OS2) || @@ -287,6 +308,11 @@ static inline int ncp_preserve_case(struct inode *i) 0; } +static inline int ncp_preserve_case(struct inode *i) +{ + return ncp_preserve_entry_case(i, NW_NS_OS2); +} + static inline int ncp_case_sensitive(struct inode *i) { #ifdef CONFIG_NCPFS_NFS_NS diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h index 38492fc92..adf1eef66 100644 --- a/include/linux/ncp_fs_sb.h +++ b/include/linux/ncp_fs_sb.h @@ -73,6 +73,10 @@ struct ncp_server { size_t len; void* data; } priv; + + struct ncp_nls_ioctl nls_charsets; /* NLS user data */ + struct nls_table *nls_vol; /* codepage used on volume */ + struct nls_table *nls_io; /* charset used for input and display */ }; static inline int ncp_conn_valid(struct ncp_server *server) diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h index 54bc5b943..a214372a5 100644 --- a/include/linux/ncp_mount.h +++ b/include/linux/ncp_mount.h @@ -16,11 +16,13 @@ #define NCP_MOUNT_VERSION 3 /* Values for flags */ -#define NCP_MOUNT_SOFT 0x0001 -#define NCP_MOUNT_INTR 0x0002 -#define NCP_MOUNT_STRONG 0x0004 /* enable delete/rename of r/o files */ -#define NCP_MOUNT_NO_OS2 0x0008 -#define NCP_MOUNT_NO_NFS 0x0010 +#define NCP_MOUNT_SOFT 0x0001 +#define NCP_MOUNT_INTR 0x0002 +#define NCP_MOUNT_STRONG 0x0004 /* enable delete/rename of r/o files */ +#define NCP_MOUNT_NO_OS2 0x0008 /* do not use OS/2 (LONG) namespace */ +#define NCP_MOUNT_NO_NFS 0x0010 /* do not use NFS namespace */ +#define NCP_MOUNT_EXTRAS 0x0020 +#define NCP_MOUNT_SYMLINKS 0x0040 /* enable symlinks */ struct ncp_mount_data { int version; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 41f6405ee..18e7fde28 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -65,33 +65,6 @@ #define MAX_HEADER (LL_MAX_HEADER + 48) #endif -struct neighbour; -struct neigh_parms; -struct sk_buff; - -/* - * We tag multicasts with these structures. - */ - -struct dev_mc_list -{ - struct dev_mc_list *next; - __u8 dmi_addr[MAX_ADDR_LEN]; - unsigned char dmi_addrlen; - int dmi_users; - int dmi_gusers; -}; - -struct hh_cache -{ - struct hh_cache *hh_next; /* Next entry */ - atomic_t hh_refcnt; /* number of users */ - unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP */ - int (*hh_output)(struct sk_buff *skb); - /* cached hardware header; allow for machine alignment needs. */ - unsigned long hh_data[16/sizeof(unsigned long)]; -}; - /* * Network device statistics. Akin to the 2.0 ether stats but * with byte counters. @@ -157,6 +130,35 @@ extern const char *if_port_text[]; #include <linux/skbuff.h> +struct neighbour; +struct neigh_parms; +struct sk_buff; + +/* + * We tag multicasts with these structures. + */ + +struct dev_mc_list +{ + struct dev_mc_list *next; + __u8 dmi_addr[MAX_ADDR_LEN]; + unsigned char dmi_addrlen; + int dmi_users; + int dmi_gusers; +}; + +struct hh_cache +{ + struct hh_cache *hh_next; /* Next entry */ + atomic_t hh_refcnt; /* number of users */ + unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP */ + int (*hh_output)(struct sk_buff *skb); + rwlock_t hh_lock; + /* cached hardware header; allow for machine alignment needs. */ + unsigned long hh_data[16/sizeof(unsigned long)]; +}; + + /* * The DEVICE structure. * Actually, this whole structure is a big mistake. It mixes I/O @@ -432,6 +434,7 @@ extern int dev_mc_add(struct device *dev, void *addr, int alen, int newonly); extern void dev_mc_discard(struct device *dev); extern void dev_set_promiscuity(struct device *dev, int inc); extern void dev_set_allmulti(struct device *dev, int inc); +extern void netdev_state_change(struct device *dev); /* Load a device via the kmod */ extern void dev_load(const char *name); extern void dev_mcast_init(void); diff --git a/include/linux/nfs.h b/include/linux/nfs.h index c4aab89e1..7936d5a71 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h @@ -41,6 +41,7 @@ enum nfs_stat { NFSERR_FBIG = 27, NFSERR_NOSPC = 28, NFSERR_ROFS = 30, + NFSERR_OPNOTSUPP = 45, NFSERR_NAMETOOLONG = 63, NFSERR_NOTEMPTY = 66, NFSERR_DQUOT = 69, diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index afd52c619..af9615066 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -98,8 +98,7 @@ do { \ struct nfs_wreq { struct rpc_listitem wb_list; /* linked list of req's */ struct rpc_task wb_task; /* RPC task */ - struct dentry * wb_dentry; /* dentry referenced */ - struct inode * wb_inode; /* inode referenced */ + struct file * wb_file; /* dentry referenced */ struct page * wb_page; /* page to be written */ struct wait_queue * wb_wait; /* wait for completion */ unsigned int wb_offset; /* offset within page */ @@ -182,6 +181,8 @@ extern struct inode *nfs_fhget(struct dentry *, struct nfs_fh *, struct nfs_fattr *); extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); extern int nfs_revalidate(struct dentry *); +extern int nfs_open(struct inode *, struct file *); +extern int nfs_release(struct inode *, struct file *); extern int _nfs_revalidate_inode(struct nfs_server *, struct dentry *); /* @@ -213,7 +214,6 @@ extern int nfs_lock(struct file *, int, struct file_lock *); */ extern int nfs_writepage(struct file *, struct page *); extern int nfs_check_failed_request(struct inode *); -extern int nfs_check_error(struct inode *); /* * Try to write back everything synchronously (but check the @@ -221,8 +221,7 @@ extern int nfs_check_error(struct inode *); */ extern int nfs_wb_all(struct inode *); extern int nfs_wb_page(struct inode *, struct page *); -extern int nfs_wb_pid(struct inode *, pid_t); -extern int nfs_flush_trunc(struct inode *, unsigned long); +extern int nfs_wb_file(struct inode *, struct file *); /* * Invalidate write-backs, possibly trying to write them @@ -254,12 +253,6 @@ nfs_revalidate_inode(struct nfs_server *server, struct dentry *dentry) return _nfs_revalidate_inode(server, dentry); } -static inline int -nfs_write_error(struct inode *inode) -{ - return NFS_WRITEBACK(inode) && nfs_check_error(inode); -} - /* NFS root */ extern int nfs_root_mount(struct super_block *sb); diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index e33eaa418..dc16282e1 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h @@ -107,6 +107,9 @@ void nfsd_fh_flush(kdev_t); void nfsd_fh_init(void); void nfsd_fh_free(void); +void expire_all(void); +void expire_by_dentry(struct dentry *); + static __inline__ struct svc_fh * fh_copy(struct svc_fh *dst, struct svc_fh *src) { diff --git a/include/linux/openpic.h b/include/linux/openpic.h index ea3123483..9cf18c5da 100644 --- a/include/linux/openpic.h +++ b/include/linux/openpic.h @@ -313,15 +313,6 @@ extern u_char *OpenPIC_InitSenses; #define Vector_Priority _Vector_Priority.Reg #define Destination _Destination.Reg - - /* - * Vendor and Device IDs - */ - -#define OPENPIC_VENDOR_ID_APPLE 0x14 -#define OPENPIC_DEVICE_ID_APPLE_HYDRA 0x46 - - /* * OpenPIC Operations */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index e9305f9b8..3e1e89b44 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -17,10 +17,29 @@ static inline unsigned long page_address(struct page * page) return PAGE_OFFSET + PAGE_SIZE * (page - mem_map); } -#define PAGE_HASH_BITS 11 -#define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS) +/* + * The page cache can done in larger chunks than + * one page, because it allows for more efficient + * throughput (it can then be mapped into user + * space in smaller chunks for same flexibility). + * + * Or rather, it _will_ be done in larger chunks. + */ +#define PAGE_CACHE_SHIFT PAGE_SHIFT +#define PAGE_CACHE_SIZE PAGE_SIZE +#define PAGE_CACHE_MASK PAGE_MASK + +#define page_cache_alloc() __get_free_page(GFP_USER) +#define page_cache_free(x) free_page(x) +#define page_cache_release(x) __free_page(x) -#define PAGE_AGE_VALUE 16 +/* + * From a kernel address, get the "struct page *" + */ +#define page_cache_entry(x) (mem_map + MAP_NR(x)) + +#define PAGE_HASH_BITS 12 +#define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS) extern unsigned long page_cache_size; /* # of pages currently in the hash table */ extern struct page * page_hash_table[PAGE_HASH_SIZE]; diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index 65d8209e5..a74c7a121 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h @@ -14,8 +14,15 @@ #define STATUS 0x1 #define DATA 0 +/* Private data for PC low-level driver. */ +struct parport_pc_private { + /* Contents of CTR. */ + unsigned char ctr; +}; + extern int parport_pc_epp_clear_timeout(struct parport *pb); +extern volatile unsigned char parport_pc_ctr; extern __inline__ void parport_pc_write_epp(struct parport *p, unsigned char d) { @@ -62,19 +69,24 @@ extern __inline__ unsigned char parport_pc_read_data(struct parport *p) extern __inline__ void parport_pc_write_control(struct parport *p, unsigned char d) { + struct parport_pc_private *priv = p->private_data; + priv->ctr = d;/* update soft copy */ outb(d, p->base+CONTROL); } extern __inline__ unsigned char parport_pc_read_control(struct parport *p) { - return inb(p->base+CONTROL); + struct parport_pc_private *priv = p->private_data; + return priv->ctr; } extern __inline__ unsigned char parport_pc_frob_control(struct parport *p, unsigned char mask, unsigned char val) { - unsigned char old = inb(p->base+CONTROL); - outb(((old & ~mask) ^ val), p->base+CONTROL); - return old; + struct parport_pc_private *priv = p->private_data; + unsigned char ctr = priv->ctr; + ctr = (ctr & ~mask) ^ val; + outb (ctr, p->base+CONTROL); + return priv->ctr = ctr; /* update soft copy */ } extern __inline__ void parport_pc_write_status(struct parport *p, unsigned char d) diff --git a/include/linux/pc_keyb.h b/include/linux/pc_keyb.h index b79ecf0eb..29ccd3956 100644 --- a/include/linux/pc_keyb.h +++ b/include/linux/pc_keyb.h @@ -114,8 +114,12 @@ extern unsigned char aux_device_present; #define AUX_ENABLE_DEV 0xF4 /* Enable aux device */ #define AUX_DISABLE_DEV 0xF5 /* Disable aux device */ #define AUX_RESET 0xFF /* Reset aux device */ +#define AUX_ACK 0xFA /* Command byte ACK. */ -#define AUX_BUF_SIZE 2048 +#define AUX_BUF_SIZE 2048 /* This might be better divisible by + three to make overruns stay in sync + but then the read function would need + a lock etc - ick */ struct aux_queue { unsigned long head; diff --git a/include/linux/pci.h b/include/linux/pci.h index 6ba04c1d3..a4e4b9dfe 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -3,7 +3,7 @@ * * PCI defines and function prototypes * Copyright 1994, Drew Eckhardt - * Copyright 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz> + * Copyright 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz> * * For more information, please consult the following manuals (look at * http://www.pcisig.com/ for how to get them): @@ -36,9 +36,9 @@ #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ #define PCI_STATUS 0x06 /* 16 bits */ +#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ #define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ #define PCI_STATUS_UDF 0x40 /* Support User Definable Features */ - #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ @@ -101,7 +101,9 @@ #define PCI_ROM_ADDRESS_ENABLE 0x01 #define PCI_ROM_ADDRESS_MASK (~0x7ffUL) -/* 0x34-0x3b are reserved */ +#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ + +/* 0x35-0x3b are reserved */ #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ #define PCI_MIN_GNT 0x3e /* 8 bits */ @@ -182,6 +184,12 @@ #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ /* 0x48-0x7f reserved */ +/* Capability lists */ +#define PCI_CAP_LIST_ID 0 /* Capability ID */ +#define PCI_CAP_ID_PM 0x01 /* Power Management */ +#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ +#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ + /* Device classes and subclasses */ #define PCI_CLASS_NOT_DEFINED 0x0000 @@ -356,6 +364,7 @@ #define PCI_DEVICE_ID_DEC_21052 0x0021 #define PCI_DEVICE_ID_DEC_21150 0x0022 #define PCI_DEVICE_ID_DEC_21152 0x0024 +#define PCI_DEVICE_ID_DEC_21153 0x0025 #define PCI_VENDOR_ID_CIRRUS 0x1013 #define PCI_DEVICE_ID_CIRRUS_7548 0x0038 @@ -379,6 +388,7 @@ #define PCI_DEVICE_ID_IBM_82G2675 0x001d #define PCI_DEVICE_ID_IBM_MCA 0x0020 #define PCI_DEVICE_ID_IBM_82351 0x0022 +#define PCI_DEVICE_ID_IBM_PYTHON 0x002d #define PCI_DEVICE_ID_IBM_SERVERAID 0x002e #define PCI_DEVICE_ID_IBM_TR_WAKE 0x003e #define PCI_DEVICE_ID_IBM_MPIC 0x0046 @@ -894,6 +904,10 @@ #define PCI_VENDOR_ID_CYCLADES 0x120e #define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100 #define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101 +#define PCI_DEVICE_ID_CYCLOM_4Y_Lo 0x0102 +#define PCI_DEVICE_ID_CYCLOM_4Y_Hi 0x0103 +#define PCI_DEVICE_ID_CYCLOM_8Y_Lo 0x0104 +#define PCI_DEVICE_ID_CYCLOM_8Y_Hi 0x0105 #define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 #define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 @@ -916,6 +930,9 @@ #define PCI_VENDOR_ID_CCUBE 0x123f +#define PCI_VENDOR_ID_AVM 0x1244 +#define PCI_DEVICE_ID_AVM_A1 0x0a00 + #define PCI_VENDOR_ID_DIPIX 0x1246 #define PCI_VENDOR_ID_STALLION 0x124d @@ -952,6 +969,9 @@ #define PCI_VENDOR_ID_CBOARDS 0x1307 #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 +#define PCI_VENDOR_ID_NETGEAR 0x1385 +#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a + #define PCI_VENDOR_ID_SYMPHONY 0x1c1c #define PCI_DEVICE_ID_SYMPHONY_101 0x0001 @@ -1037,6 +1057,7 @@ #define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 #define PCI_DEVICE_ID_INTEL_P6 0x84c4 #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 +#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca #define PCI_VENDOR_ID_KTI 0x8e2e #define PCI_DEVICE_ID_KTI_ET32P2 0x3000 @@ -1203,6 +1224,7 @@ void pci_init(void); void pci_setup(char *str, int *ints); void pci_quirks_init(void); unsigned int pci_scan_bus(struct pci_bus *bus); +struct pci_bus *pci_scan_peer_bridge(int bus); void pci_proc_init(void); void proc_old_pci_init(void); int get_pci_list(char *buf); diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 0c38cac86..36935ed3a 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h @@ -23,9 +23,12 @@ enum TCA_POLICE_TBF, TCA_POLICE_RATE, TCA_POLICE_PEAKRATE, + TCA_POLICE_AVRATE, + TCA_POLICE_RESULT +#define TCA_POLICE_RESULT TCA_POLICE_RESULT }; -#define TCA_POLICE_MAX TCA_POLICE_PEAKRATE +#define TCA_POLICE_MAX TCA_POLICE_RESULT /* U32 filters */ @@ -114,4 +117,30 @@ struct tc_rsvp_pinfo __u8 tunnelhdr; }; +/* ROUTE filter */ + +enum +{ + TCA_ROUTE4_UNSPEC, + TCA_ROUTE4_CLASSID, + TCA_ROUTE4_TO, + TCA_ROUTE4_FROM, + TCA_ROUTE4_IIF, + TCA_ROUTE4_POLICE, +}; + +#define TCA_ROUTE4_MAX TCA_ROUTE4_POLICE + + +/* FW filter */ + +enum +{ + TCA_FW_UNSPEC, + TCA_FW_CLASSID, + TCA_FW_POLICE, +}; + +#define TCA_FW_MAX TCA_FW_POLICE + #endif diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index e02d072f7..1de3fe2ec 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -174,6 +174,7 @@ enum scsi_directory_inos { PROC_SCSI_SEAGATE, PROC_SCSI_T128, PROC_SCSI_NCR53C7xx, + PROC_SCSI_SYM53C8XX, PROC_SCSI_NCR53C8XX, PROC_SCSI_ULTRASTOR, PROC_SCSI_7000FASST, @@ -184,6 +185,7 @@ enum scsi_directory_inos { PROC_SCSI_AM53C974, PROC_SCSI_SSC, PROC_SCSI_NCR53C406A, + PROC_SCSI_SYM53C416, PROC_SCSI_MEGARAID, PROC_SCSI_PPA, PROC_SCSI_ATP870U, @@ -203,6 +205,8 @@ enum scsi_directory_inos { PROC_SCSI_53C94, PROC_SCSI_PLUTO, PROC_SCSI_INI9100U, + PROC_SCSI_INIA100, + PROC_SCSI_FCAL, PROC_SCSI_SCSI_DEBUG, PROC_SCSI_NOT_PRESENT, PROC_SCSI_FILE, /* I'm assuming here that we */ @@ -379,7 +383,7 @@ extern int proc_match(int, const char *,struct proc_dir_entry *); * of the /proc/<pid> subdirectories. */ extern int proc_readdir(struct file *, void *, filldir_t); -extern int proc_lookup(struct inode *, struct dentry *); +extern struct dentry *proc_lookup(struct inode *, struct dentry *); struct openpromfs_dev { struct openpromfs_dev *next; @@ -391,7 +395,7 @@ struct openpromfs_dev { }; extern struct inode_operations * proc_openprom_register(int (*readdir)(struct file *, void *, filldir_t), - int (*lookup)(struct inode *, struct dentry *), + struct dentry * (*lookup)(struct inode *, struct dentry *), void (*use)(struct inode *, int), struct openpromfs_dev ***); extern void proc_openprom_deregister(void); diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h index eb2b3dc08..c5a010394 100644 --- a/include/linux/qnx4_fs.h +++ b/include/linux/qnx4_fs.h @@ -95,7 +95,7 @@ struct qnx4_super_block { #define QNX4DEBUG(X) (void) 0 #endif -extern int qnx4_lookup(struct inode *dir, struct dentry *dentry); +extern struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry); extern unsigned long qnx4_count_free_inodes(struct super_block *sb); extern unsigned long qnx4_count_free_blocks(struct super_block *sb); diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index a2a00a04c..b31daec41 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -55,7 +55,7 @@ extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, const struct { if (sb->dq_op) { if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), - current->euid, 0) == NO_QUOTA) + current->fsuid, 0) == NO_QUOTA) return 1; } return 0; @@ -65,7 +65,7 @@ extern __inline__ int DQUOT_ALLOC_BLOCK(struct super_block *sb, const struct ino { if (sb->dq_op) { if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), - current->euid, 1) == NO_QUOTA) + current->fsuid, 1) == NO_QUOTA) return 1; } return 0; @@ -75,7 +75,7 @@ extern __inline__ int DQUOT_ALLOC_INODE(struct super_block *sb, struct inode *in { if (sb->dq_op) { sb->dq_op->initialize (inode, -1); - if (sb->dq_op->alloc_inode (inode, 1, current->euid)) + if (sb->dq_op->alloc_inode (inode, 1, current->fsuid)) return 1; } inode->i_flags |= S_QUOTA; @@ -101,11 +101,11 @@ extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr) if (dentry->d_inode->i_sb->dq_op) { if (IS_QUOTAINIT(dentry->d_inode) == 0) dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1); - if (dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 0, current->euid)) + if (dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 0, current->fsuid)) goto out; error = notify_change(dentry, iattr); if (error) - dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 1, current->euid); + dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 1, current->fsuid); } else { error = notify_change(dentry, iattr); } diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index be607392c..b339f6528 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -139,6 +139,7 @@ enum #define RTPROT_RA 9 /* RDISC/ND router advertisments */ #define RTPROT_MRT 10 /* Merit MRT */ #define RTPROT_ZEBRA 11 /* Zebra */ +#define RTPROT_BIRD 12 /* BIRD */ /* rtm_scope diff --git a/include/linux/sched.h b/include/linux/sched.h index b37bce2cc..e0066b3f6 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -112,9 +112,10 @@ struct sched_param { * a separate lock). */ extern rwlock_t tasklist_lock; -extern spinlock_t scheduler_lock; +extern spinlock_t runqueue_lock; extern void sched_init(void); +extern void init_idle(void); extern void show_state(void); extern void trap_init(void); @@ -174,6 +175,8 @@ struct mm_struct { unsigned long rss, total_vm, locked_vm; unsigned long def_flags; unsigned long cpu_vm_mask; + unsigned long swap_cnt; /* number of pages to swap on next pass */ + unsigned long swap_address; /* * This is an architecture-specific pointer: the portable * part of Linux does not know about any segments. @@ -191,7 +194,7 @@ struct mm_struct { 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, \ - 0, 0, NULL } + 0, 0, 0, 0, NULL } struct signal_struct { atomic_t count; @@ -276,8 +279,6 @@ struct task_struct { /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap; int swappable:1; - unsigned long swap_address; - unsigned long swap_cnt; /* number of pages to swap on next pass */ /* process credentials */ uid_t uid,euid,suid,fsuid; gid_t gid,egid,sgid,fsgid; @@ -361,7 +362,7 @@ struct task_struct { /* utime */ {0,0,0,0},0, \ /* per CPU times */ {0, }, {0, }, \ /* flt */ 0,0,0,0,0,0, \ -/* swp */ 0,0,0, \ +/* swp */ 0, \ /* process credentials */ \ /* uid etc */ 0,0,0,0,0,0,0,0, \ /* suppl grps*/ 0, {0,}, \ @@ -673,6 +674,58 @@ extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * write_unlock_irqrestore(&waitqueue_lock, flags); } +#define __wait_event(wq, condition) \ +do { \ + struct wait_queue __wait; \ + \ + __wait.task = current; \ + add_wait_queue(&wq, &__wait); \ + for (;;) { \ + current->state = TASK_UNINTERRUPTIBLE; \ + if (condition) \ + break; \ + schedule(); \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ +} while (0) + +#define wait_event(wq, condition) \ +do { \ + if (condition) \ + break; \ + __wait_event(wq, condition); \ +} while (0) + +#define __wait_event_interruptible(wq, condition, ret) \ +do { \ + struct wait_queue __wait; \ + \ + __wait.task = current; \ + add_wait_queue(&wq, &__wait); \ + for (;;) { \ + current->state = TASK_INTERRUPTIBLE; \ + if (condition) \ + break; \ + if (!signal_pending(current)) { \ + schedule(); \ + continue; \ + } \ + ret = -ERESTARTSYS; \ + break; \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ +} while (0) + +#define wait_event_interruptible(wq, condition) \ +({ \ + int __ret = 0; \ + if (!(condition)) \ + __wait_event_interruptible(wq, condition, __ret); \ + __ret; \ +}) + #define REMOVE_LINKS(p) do { \ (p)->next_task->prev_task = (p)->prev_task; \ (p)->prev_task->next_task = (p)->next_task; \ diff --git a/include/linux/selection.h b/include/linux/selection.h index 45e4712b4..74d1b24d6 100644 --- a/include/linux/selection.h +++ b/include/linux/selection.h @@ -38,7 +38,7 @@ extern void invert_screen(int currcons, int offset, int count, int shift); extern void getconsxy(int currcons, char *p); extern void putconsxy(int currcons, char *p); -extern u16 vcs_scr_readw(int currcons, u16 *org); +extern u16 vcs_scr_readw(int currcons, const u16 *org); extern void vcs_scr_writew(int currcons, u16 val, u16 *org); #endif diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index 35478fe4d..a151a75e6 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -14,7 +14,7 @@ /* * ioctl commands */ -#define SMB_IOC_GETMOUNTUID _IOR('u', 1, uid_t) +#define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_uid_t) #define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt) #ifdef __KERNEL__ diff --git a/include/linux/smp.h b/include/linux/smp.h index 80ea3056f..75c34e87f 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -42,6 +42,12 @@ extern void smp_callin(void); extern void smp_commence(void); /* + * Call a function on all other processors + */ +extern int smp_call_function (void (*func) (void *info), void *info, + int retry, int wait); + +/* * True once the per process idle is forked */ extern int smp_threads_ready; @@ -60,7 +66,7 @@ extern volatile int smp_msg_id; * when rebooting */ #define MSG_RESCHEDULE 0x0003 /* Reschedule request from master CPU*/ -#define MSG_MTRR_CHANGE 0x0004 /* Change MTRR */ +#define MSG_CALL_FUNCTION 0x0004 /* Call function on all other CPUs */ #else @@ -68,12 +74,13 @@ extern volatile int smp_msg_id; * These macros fold the SMP functionality into a single CPU system */ -#define smp_num_cpus 1 -#define smp_processor_id() 0 -#define hard_smp_processor_id() 0 -#define smp_threads_ready 1 +#define smp_num_cpus 1 +#define smp_processor_id() 0 +#define hard_smp_processor_id() 0 +#define smp_threads_ready 1 #define kernel_lock() -#define cpu_logical_map(cpu) 0 +#define cpu_logical_map(cpu) 0 +#define smp_call_function(func,info,retry,wait) #endif #endif diff --git a/include/linux/socket.h b/include/linux/socket.h index 41e759751..bcb7ce731 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -234,6 +234,7 @@ struct ucred { #define SOL_PACKET 263 #define SOL_ATM 264 /* ATM layer (cell level) */ #define SOL_AAL 265 /* ATM Adaption Layer (packet level) */ +#define SOL_IRDA 266 /* IPX options */ #define IPX_TYPE 1 diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 8563307a8..5f8dc8768 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h @@ -39,7 +39,7 @@ struct svc_sock { void (*sk_odata)(struct sock *, int bytes); /* private TCP part */ - unsigned long sk_reclen; /* length of record */ + int sk_reclen; /* length of record */ int sk_tcplen; /* current read length */ /* Debugging */ diff --git a/include/linux/synclink.h b/include/linux/synclink.h new file mode 100644 index 000000000..69dc86725 --- /dev/null +++ b/include/linux/synclink.h @@ -0,0 +1,243 @@ +/* + * SyncLink Multiprotocol Serial Adapter Driver + * + * Copyright (C) 1998 by Microgate Corporation + * + * Redistribution of this file is permitted under + * the terms of the GNU Public License (GPL) + */ + +#ifndef _SYNCLINK_H_ +#define _SYNCLINK_H_ + +#define BOOLEAN int +#define TRUE 1 +#define FALSE 0 + +#define BIT0 0x0001 +#define BIT1 0x0002 +#define BIT2 0x0004 +#define BIT3 0x0008 +#define BIT4 0x0010 +#define BIT5 0x0020 +#define BIT6 0x0040 +#define BIT7 0x0080 +#define BIT8 0x0100 +#define BIT9 0x0200 +#define BIT10 0x0400 +#define BIT11 0x0800 +#define BIT12 0x1000 +#define BIT13 0x2000 +#define BIT14 0x4000 +#define BIT15 0x8000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 + + +#define HDLC_MAX_FRAME_SIZE 4096 +#define MAX_ASYNC_TRANSMIT 4096 + +#define ASYNC_PARITY_NONE 0 +#define ASYNC_PARITY_EVEN 1 +#define ASYNC_PARITY_ODD 2 +#define ASYNC_PARITY_SPACE 3 + +#define HDLC_FLAG_UNDERRUN_ABORT7 0x0000 +#define HDLC_FLAG_UNDERRUN_ABORT15 0x0001 +#define HDLC_FLAG_UNDERRUN_FLAG 0x0002 +#define HDLC_FLAG_UNDERRUN_CRC 0x0004 +#define HDLC_FLAG_SHARE_ZERO 0x0010 +#define HDLC_FLAG_AUTO_CTS 0x0020 +#define HDLC_FLAG_AUTO_DCD 0x0040 +#define HDLC_FLAG_AUTO_RTS 0x0080 +#define HDLC_FLAG_RXC_DPLL 0x0100 +#define HDLC_FLAG_RXC_BRG 0x0200 +#define HDLC_FLAG_TXC_DPLL 0x0400 +#define HDLC_FLAG_TXC_BRG 0x0800 +#define HDLC_FLAG_DPLL_DIV8 0x1000 +#define HDLC_FLAG_DPLL_DIV16 0x2000 +#define HDLC_FLAG_DPLL_DIV32 0x0000 + +#define HDLC_CRC_NONE 0 +#define HDLC_CRC_16_CCITT 1 + +#define HDLC_TXIDLE_FLAGS 0 +#define HDLC_TXIDLE_ALT_ZEROS_ONES 1 +#define HDLC_TXIDLE_ZEROS 2 +#define HDLC_TXIDLE_ONES 3 +#define HDLC_TXIDLE_ALT_MARK_SPACE 4 +#define HDLC_TXIDLE_SPACE 5 +#define HDLC_TXIDLE_MARK 6 + +#define HDLC_ENCODING_NRZ 0 +#define HDLC_ENCODING_NRZB 1 +#define HDLC_ENCODING_NRZI_MARK 2 +#define HDLC_ENCODING_NRZI_SPACE 3 +#define HDLC_ENCODING_BIPHASE_MARK 4 +#define HDLC_ENCODING_BIPHASE_SPACE 5 +#define HDLC_ENCODING_BIPHASE_LEVEL 6 +#define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7 + +#define HDLC_PREAMBLE_LENGTH_8BITS 0 +#define HDLC_PREAMBLE_LENGTH_16BITS 1 +#define HDLC_PREAMBLE_LENGTH_32BITS 2 +#define HDLC_PREAMBLE_LENGTH_64BITS 3 + +#define HDLC_PREAMBLE_PATTERN_NONE 0 +#define HDLC_PREAMBLE_PATTERN_ZEROS 1 +#define HDLC_PREAMBLE_PATTERN_FLAGS 2 +#define HDLC_PREAMBLE_PATTERN_10 3 +#define HDLC_PREAMBLE_PATTERN_01 4 +#define HDLC_PREAMBLE_PATTERN_ONES 5 + +#define MGSL_MODE_ASYNC 1 +#define MGSL_MODE_HDLC 2 + +#define MGSL_BUS_TYPE_ISA 1 +#define MGSL_BUS_TYPE_EISA 2 +#define MGSL_BUS_TYPE_PCI 5 + +typedef struct _MGSL_PARAMS +{ + /* Common */ + + unsigned long mode; /* Asynchronous or HDLC */ + unsigned char loopback; /* internal loopback mode */ + + /* HDLC Only */ + + unsigned short flags; + unsigned char encoding; /* NRZ, NRZI, etc. */ + unsigned long clock_speed; /* external clock speed in bits per second */ + unsigned char addr_filter; /* receive HDLC address filter, 0xFF = disable */ + unsigned short crc_type; /* None, CRC16 or CRC16-CCITT */ + unsigned char preamble_length; + unsigned char preamble; + + /* Async Only */ + + unsigned long data_rate; /* bits per second */ + unsigned char data_bits; /* 7 or 8 data bits */ + unsigned char stop_bits; /* 1 or 2 stop bits */ + unsigned char parity; /* none, even, or odd */ + +} MGSL_PARAMS, *PMGSL_PARAMS; + +#define MICROGATE_VENDOR_ID 0x13c0 +#define SYNCLINK_DEVICE_ID 0x0010 +#define MGSL_MAX_SERIAL_NUMBER 30 + +/* +** device diagnostics status +*/ + +#define DiagStatus_OK 0 +#define DiagStatus_AddressFailure 1 +#define DiagStatus_AddressConflict 2 +#define DiagStatus_IrqFailure 3 +#define DiagStatus_IrqConflict 4 +#define DiagStatus_DmaFailure 5 +#define DiagStatus_DmaConflict 6 +#define DiagStatus_PciAdapterNotFound 7 +#define DiagStatus_CantAssignPciResources 8 +#define DiagStatus_CantAssignPciMemAddr 9 +#define DiagStatus_CantAssignPciIoAddr 10 +#define DiagStatus_CantAssignPciIrq 11 +#define DiagStatus_MemoryError 12 + +#define SerialSignal_DCD 0x01 /* Data Carrier Detect */ +#define SerialSignal_TXD 0x02 /* Transmit Data */ +#define SerialSignal_RI 0x04 /* Ring Indicator */ +#define SerialSignal_RXD 0x08 /* Receive Data */ +#define SerialSignal_CTS 0x10 /* Clear to Send */ +#define SerialSignal_RTS 0x20 /* Request to Send */ +#define SerialSignal_DSR 0x40 /* Data Set Ready */ +#define SerialSignal_DTR 0x80 /* Data Terminal Ready */ + + +/* + * Counters of the input lines (CTS, DSR, RI, CD) interrupts + */ +struct mgsl_icount { + __u32 cts, dsr, rng, dcd, tx, rx; + __u32 frame, parity, overrun, brk; + __u32 buf_overrun; + __u32 txok; + __u32 txunder; + __u32 txabort; + __u32 txtimeout; + __u32 rxshort; + __u32 rxlong; + __u32 rxabort; + __u32 rxover; + __u32 rxcrc; + __u32 rxok; + __u32 exithunt; + __u32 rxidle; +}; + + +#define DEBUG_LEVEL_DATA 1 +#define DEBUG_LEVEL_ERROR 2 +#define DEBUG_LEVEL_INFO 3 +#define DEBUG_LEVEL_BH 4 +#define DEBUG_LEVEL_ISR 5 + +/* +** Event bit flags for use with MgslWaitEvent +*/ + +#define MgslEvent_DsrActive 0x0001 +#define MgslEvent_DsrInactive 0x0002 +#define MgslEvent_Dsr 0x0003 +#define MgslEvent_CtsActive 0x0004 +#define MgslEvent_CtsInactive 0x0008 +#define MgslEvent_Cts 0x000c +#define MgslEvent_DcdActive 0x0010 +#define MgslEvent_DcdInactive 0x0020 +#define MgslEvent_Dcd 0x0030 +#define MgslEvent_RiActive 0x0040 +#define MgslEvent_RiInactive 0x0080 +#define MgslEvent_Ri 0x00c0 +#define MgslEvent_ExitHuntMode 0x0100 +#define MgslEvent_IdleReceived 0x0200 + +/* Private IOCTL codes: + * + * MGSL_IOCSPARAMS set MGSL_PARAMS structure values + * MGSL_IOCGPARAMS get current MGSL_PARAMS structure values + * MGSL_IOCSTXIDLE set current transmit idle mode + * MGSL_IOCGTXIDLE get current transmit idle mode + * MGSL_IOCTXENABLE enable or disable transmitter + * MGSL_IOCRXENABLE enable or disable receiver + * MGSL_IOCTXABORT abort transmitting frame (HDLC) + * MGSL_IOCGSTATS return current statistics + * MGSL_IOCWAITEVENT wait for specified event to occur + */ +#define MGSL_MAGIC_IOC 'm' +#define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,sizeof(MGSL_PARAMS)) +#define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,sizeof(MGSL_PARAMS)) +#define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2) +#define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3) +#define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4) +#define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5) +#define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6) +#define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7) +#define MGSL_IOCWAITEVENT _IO(MGSL_MAGIC_IOC,8) +#define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15) + +#endif /* _SYNCLINK_H_ */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 413864d40..db74f03be 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -56,9 +56,15 @@ enum CTL_PROC=4, /* Process info */ CTL_FS=5, /* Filesystems */ CTL_DEBUG=6, /* Debugging */ - CTL_DEV=7 /* Devices */ + CTL_DEV=7, /* Devices */ + CTL_BUS=8 /* Buses */ }; +/* CTL_BUS names: */ +enum +{ + BUS_ISA=1 /* ISA */ +}; /* CTL_KERN names: */ enum @@ -133,9 +139,17 @@ enum NET_IPV6=12, NET_X25=13, NET_TR=14, - NET_DECNET=15 + NET_DECNET=15, + NET_ECONET=16 }; +/* /proc/sys/bus/isa */ +enum +{ + BUS_ISA_MEM_BASE=1, + BUS_ISA_PORT_BASE=2, + BUS_ISA_PORT_SHIFT=3 +}; /* /proc/sys/net/core */ enum @@ -161,7 +175,8 @@ enum enum { NET_UNIX_DESTROY_DELAY=1, - NET_UNIX_DELETE_DELAY=2 + NET_UNIX_DELETE_DELAY=2, + NET_UNIX_MAX_DGRAM_QLEN=3, }; /* /proc/sys/net/ipv4 */ @@ -225,7 +240,8 @@ enum { NET_IPV4_ROUTE_REDIRECT_SILENCE=11, NET_IPV4_ROUTE_ERROR_COST=12, NET_IPV4_ROUTE_ERROR_BURST=13, - NET_IPV4_ROUTE_GC_ELASTICITY=14 + NET_IPV4_ROUTE_GC_ELASTICITY=14, + NET_IPV4_ROUTE_MTU_EXPIRES=15 }; enum @@ -265,7 +281,8 @@ enum { NET_IPV6_ROUTE_GC_MIN_INTERVAL=4, NET_IPV6_ROUTE_GC_TIMEOUT=5, NET_IPV6_ROUTE_GC_INTERVAL=6, - NET_IPV6_ROUTE_GC_ELASTICITY=7 + NET_IPV6_ROUTE_GC_ELASTICITY=7, + NET_IPV6_ROUTE_MTU_EXPIRES=8 }; enum { diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index 547e5c2c1..49d9d24f1 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -367,7 +367,7 @@ sv_bread (struct super_block *sb, kdev_t dev, unsigned int block) * Function prototypes */ -extern int sysv_lookup(struct inode * dir, struct dentry * dentry); +extern struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry); extern int sysv_create(struct inode * dir, struct dentry * dentry, int mode); extern int sysv_mkdir(struct inode * dir, struct dentry * dentry, int mode); extern int sysv_rmdir(struct inode * dir, struct dentry * dentry); @@ -398,7 +398,6 @@ extern void sysv_write_super(struct super_block *); extern void sysv_read_inode(struct inode *); extern int sysv_notify_change(struct dentry *, struct iattr *); extern void sysv_write_inode(struct inode *); -extern void sysv_put_inode(struct inode *); extern int sysv_statfs(struct super_block *, struct statfs *, int); extern int sysv_sync_inode(struct inode *); extern int sysv_sync_file(struct file *, struct dentry *); diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index 4d59ee872..d886f7533 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -59,7 +59,7 @@ extern task_queue tq_timer, tq_immediate, tq_scheduler, tq_disk; * * struct tq_struct *my_bh = NULL; * struct tq_struct run_my_bh = { - * 0, 0, (void *)(void *) run_task_queue, &my_bh + * 0, 0, (void (*)(void *)) run_task_queue, &my_bh * }; * * To activate a bottom half on your list, use: diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index 65d26195f..e36ceba9e 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -93,6 +93,7 @@ #define UFS_ST_OLD 0x00000000 #define UFS_ST_44BSD 0x00000100 #define UFS_ST_SUN 0x00000200 +#define UFS_ST_SUNx86 0x00000400 /*cylinder group encoding */ #define UFS_CG_MASK 0x00003000 /* mask for the following */ #define UFS_CG_OLD 0x00000000 @@ -110,12 +111,13 @@ #define UFS_MOUNT_ONERROR_UMOUNT 0x00000004 #define UFS_MOUNT_ONERROR_REPAIR 0x00000008 -#define UFS_MOUNT_UFSTYPE 0x000001F0 +#define UFS_MOUNT_UFSTYPE 0x000003F0 #define UFS_MOUNT_UFSTYPE_OLD 0x00000010 #define UFS_MOUNT_UFSTYPE_44BSD 0x00000020 #define UFS_MOUNT_UFSTYPE_SUN 0x00000040 -#define UFS_MOUNT_UFSTYPE_NEXT 0x00000080 +#define UFS_MOUNT_UFSTYPE_NEXTSTEP 0x00000080 #define UFS_MOUNT_UFSTYPE_OPENSTEP 0x00000100 +#define UFS_MOUNT_UFSTYPE_SUNx86 0x00000200 #define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt #define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt @@ -203,7 +205,7 @@ #define UFS_MAXNAMLEN 255 #define UFS_MAXMNTLEN 512 #define UFS_MAXCSBUFS 31 -#define UFS_LINK_MAX EXT2_LINK_MAX +#define UFS_LINK_MAX 32000 /* * UFS_DIR_PAD defines the directory entries boundaries @@ -294,7 +296,14 @@ struct ufs_super_block { /* yet another configuration parameter */ __u32 fs_optim; /* optimization preference, see below */ /* these fields are derived from the hardware */ - __u32 fs_npsect; /* # sectors/track including spares */ + union { + struct { + __u32 fs_npsect; /* # sectors/track including spares */ + } fs_sun; + struct { + __s32 fs_state; /* file system state time stamp */ + } fs_sunx86; + } fs_u1; __u32 fs_interleave; /* hardware sector interleave */ __u32 fs_trackskew; /* sector 0 skew, per track */ /* a unique id for this filesystem (currently unused and unmaintained) */ @@ -319,11 +328,11 @@ struct ufs_super_block { /* this data must be re-computed after crashes */ struct ufs_csum fs_cstotal; /* cylinder summary information */ /* these fields are cleared at mount time */ - __u8 fs_fmod; /* super block modified flag */ - __u8 fs_clean; /* file system is clean flag */ - __u8 fs_ronly; /* mounted read-only flag */ - __u8 fs_flags; /* currently unused flag */ - __u8 fs_fsmnt[UFS_MAXMNTLEN]; /* name mounted on */ + __s8 fs_fmod; /* super block modified flag */ + __s8 fs_clean; /* file system is clean flag */ + __s8 fs_ronly; /* mounted read-only flag */ + __s8 fs_flags; /* currently unused flag */ + __s8 fs_fsmnt[UFS_MAXMNTLEN]; /* name mounted on */ /* these fields retain the current block allocation info */ __u32 fs_cgrotor; /* last cg searched */ __u32 fs_csp[UFS_MAXCSBUFS]; /* list of fs_cs info buffers */ @@ -340,6 +349,14 @@ struct ufs_super_block { __u32 fs_qfmask[2]; /* ~usb_fmask */ } fs_sun; struct { + __s32 fs_sparecon[53];/* reserved for future constants */ + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __u32 fs_npsect; /* # sectors/track including spares */ + __u32 fs_qbmask[2]; /* ~usb_bmask */ + __u32 fs_qfmask[2]; /* ~usb_fmask */ + } fs_sunx86; + struct { __s32 fs_sparecon[50];/* reserved for future constants */ __s32 fs_contigsumsize;/* size of cluster summary array */ __s32 fs_maxsymlinklen;/* max length of an internal symlink */ @@ -349,7 +366,7 @@ struct ufs_super_block { __u32 fs_qfmask[2]; /* ~usb_fmask */ __s32 fs_state; /* file system state time stamp */ } fs_44; - } fs_u; + } fs_u2; __s32 fs_postblformat; /* format of positional layout tables */ __s32 fs_nrpos; /* number of rotational positions */ __s32 fs_postbloff; /* (__s16) rotation block list head */ @@ -523,7 +540,7 @@ extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *); extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *); /* namei.c */ -extern int ufs_lookup (struct inode *, struct dentry *); +extern struct dentry *ufs_lookup (struct inode *, struct dentry *); extern int ufs_mkdir(struct inode *, struct dentry *, int); extern int ufs_rmdir (struct inode *, struct dentry *); extern int ufs_unlink (struct inode *, struct dentry *); diff --git a/include/linux/ufs_fs_sb.h b/include/linux/ufs_fs_sb.h index 6ad0e0d96..2fc49e99f 100644 --- a/include/linux/ufs_fs_sb.h +++ b/include/linux/ufs_fs_sb.h @@ -116,8 +116,6 @@ struct ufs_sb_private_info { struct ufs_sb_info { struct ufs_sb_private_info * s_uspi; struct ufs_csum * s_csp[UFS_MAXCSBUFS]; - int s_rename_lock; - struct wait_queue * s_rename_wait; unsigned s_swab; unsigned s_flags; struct buffer_head ** s_ucg; @@ -167,7 +165,14 @@ struct ufs_super_block_first { __u32 fs_inopb; __u32 fs_nspf; __u32 fs_optim; - __u32 fs_npsect; + union { + struct { + __u32 fs_npsect; + } fs_sun; + struct { + __s32 fs_state; + } fs_sunx86; + } fs_u1; __u32 fs_interleave; __u32 fs_trackskew; __u32 fs_id[2]; @@ -182,16 +187,16 @@ struct ufs_super_block_first { __u32 fs_ipg; __u32 fs_fpg; struct ufs_csum fs_cstotal; - __u8 fs_fmod; - __u8 fs_clean; - __u8 fs_ronly; - __u8 fs_flags; - __u8 fs_fsmnt[UFS_MAXMNTLEN - 212]; + __s8 fs_fmod; + __s8 fs_clean; + __s8 fs_ronly; + __s8 fs_flags; + __s8 fs_fsmnt[UFS_MAXMNTLEN - 212]; }; struct ufs_super_block_second { - __u8 fs_fsmnt[212]; + __s8 fs_fsmnt[212]; __u32 fs_cgrotor; __u32 fs_csp[UFS_MAXCSBUFS]; __u32 fs_maxcluster; @@ -211,6 +216,14 @@ struct ufs_super_block_third { __u32 fs_qfmask[2]; /* ~usb_fmask */ } fs_sun; struct { + __s32 fs_sparecon[53];/* reserved for future constants */ + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __u32 fs_npsect; /* # sectors/track including spares */ + __u32 fs_qbmask[2]; /* ~usb_bmask */ + __u32 fs_qfmask[2]; /* ~usb_fmask */ + } fs_sunx86; + struct { __s32 fs_sparecon[50];/* reserved for future constants */ __s32 fs_contigsumsize;/* size of cluster summary array */ __s32 fs_maxsymlinklen;/* max length of an internal symlink */ @@ -220,7 +233,7 @@ struct ufs_super_block_third { __u32 fs_qfmask[2]; /* ~usb_fmask */ __s32 fs_state; /* file system state time stamp */ } fs_44; - } fs_u; + } fs_u2; __s32 fs_postblformat; __s32 fs_nrpos; __s32 fs_postbloff; diff --git a/include/linux/umsdos_fs.p b/include/linux/umsdos_fs.p index 1bf76e560..de436f0e8 100644 --- a/include/linux/umsdos_fs.p +++ b/include/linux/umsdos_fs.p @@ -9,9 +9,10 @@ int dummy_dir_read ( struct file *filp, char * umsdos_d_path(struct dentry *, char *, int); void umsdos_lookup_patch_new(struct dentry *, struct umsdos_info *); int umsdos_is_pseudodos (struct inode *dir, struct dentry *dentry); -int umsdos_lookup_x ( struct inode *dir, struct dentry *dentry, int nopseudo); -int UMSDOS_lookup(struct inode *, struct dentry *); +struct dentry *umsdos_lookup_x ( struct inode *dir, struct dentry *dentry, int nopseudo); +struct dentry *UMSDOS_lookup(struct inode *, struct dentry *); struct dentry *umsdos_lookup_dentry(struct dentry *, char *, int, int); +struct dentry *umsdos_covered(struct dentry *, char *, int); struct dentry *umsdos_solve_hlink (struct dentry *hlink); @@ -105,8 +106,8 @@ int UMSDOS_rename (struct inode *old_dir, struct dentry *new_dentry); /* rdir.c 22/03/95 03.31.42 */ -int umsdos_rlookup_x (struct inode *dir, struct dentry *dentry, int nopseudo); -int UMSDOS_rlookup (struct inode *dir, struct dentry *dentry); +struct dentry *umsdos_rlookup_x (struct inode *dir, struct dentry *dentry, int nopseudo); +struct dentry *UMSDOS_rlookup (struct inode *dir, struct dentry *dentry); /* symlink.c 23/01/95 03.38.30 */ diff --git a/include/linux/videodev.h b/include/linux/videodev.h index a41428d20..119b60eec 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -95,6 +95,8 @@ struct video_tuner #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ +#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ +#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ __u16 mode; /* PAL/NTSC/SECAM/OTHER */ #define VIDEO_MODE_PAL 0 #define VIDEO_MODE_NTSC 1 @@ -273,7 +275,9 @@ struct video_unit #define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */ #define VID_HARDWARE_BROADWAY 17 /* Broadway project */ #define VID_HARDWARE_GEMTEK 18 -#define VID_HARDWARE_VINO 20 /* SGI Indy Vino */ +#define VID_HARDWARE_TYPHOON 19 +#define VID_HARDWARE_VINO 20 /* Reserved for SGI Indy Vino */ +#define VID_HARDWARE_CADET 21 /* Cadet radio */ /* * Initialiser list diff --git a/include/linux/vt_buffer.h b/include/linux/vt_buffer.h index df0ee6ef1..ca1ec519d 100644 --- a/include/linux/vt_buffer.h +++ b/include/linux/vt_buffer.h @@ -41,7 +41,7 @@ extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count) #endif #ifndef VT_BUF_HAVE_MEMCPYW -extern inline void scr_memcpyw(u16 *d, u16 *s, unsigned int count) +extern inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count) { count /= 2; while (count--) @@ -50,7 +50,7 @@ extern inline void scr_memcpyw(u16 *d, u16 *s, unsigned int count) #endif #ifndef VT_BUF_HAVE_MEMMOVEW -extern inline void scr_memmovew(u16 *d, u16 *s, unsigned int count) +extern inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count) { if (d < s) scr_memcpyw(d, s, count); @@ -65,14 +65,14 @@ extern inline void scr_memmovew(u16 *d, u16 *s, unsigned int count) #endif #ifndef VT_BUF_HAVE_MEMCPYF -extern inline void scr_memcpyw_from(u16 *d, u16 *s, unsigned int count) +extern inline void scr_memcpyw_from(u16 *d, const u16 *s, unsigned int count) { count /= 2; while (count--) *d++ = scr_readw(s++); } -extern inline void scr_memcpyw_to(u16 *d, u16 *s, unsigned int count) +extern inline void scr_memcpyw_to(u16 *d, const u16 *s, unsigned int count) { count /= 2; while (count--) diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 0c2e9fb2a..d3c59fff5 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -1,7 +1,7 @@ /* * This file define a set of standard wireless extensions * - * Version : 4 12.2.97 + * Version : 7 23.4.99 * * Authors : Jean Tourrilhes - HPLB - <jt@hplb.hpl.hp.com> */ @@ -63,7 +63,7 @@ * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */ -#define WIRELESS_EXT 5 +#define WIRELESS_EXT 6 /* * Changes : @@ -82,6 +82,14 @@ * -------- * - Missing encoding definitions in range * - Access points stuff + * + * V5 to V6 + * -------- + * - 802.11 support (ESSID ioctls) + * + * V6 to V7 + * -------- + * - define IW_ESSID_MAX_SIZE and IW_MAX_AP */ /* -------------------------- IOCTL LIST -------------------------- */ @@ -113,11 +121,20 @@ #define SIOCGIWAP 0x8B15 /* get access point hardware addresses */ #define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */ +/* 802.11 specific support */ +#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */ +#define SIOCGIWESSID 0x8B1B /* get ESSID */ +/* As the ESSID is a string up to 32 bytes long, it doesn't fit within the + * 'iwreq' structure, so we need to use the 'data' member to point to a + * string in user space, like it is done for RANGE... + * The "flags" member indicate if the ESSID is active or not. + */ + /* ------------------------- IOCTL STUFF ------------------------- */ /* The first and the last (range) */ #define SIOCIWFIRST 0x8B00 -#define SIOCIWLAST 0x8B17 +#define SIOCIWLAST 0x8B1B /* Even : get (world access), odd : set (root access) */ #define IW_IS_SET(cmd) (!((cmd) & 0x1)) @@ -157,6 +174,13 @@ /* Maximum of address that you may set with SPY */ #define IW_MAX_SPY 8 +/* Maximum of address that you may get in the + list of access points in range */ +#define IW_MAX_AP 8 + +/* Maximum size of the ESSID string */ +#define IW_ESSID_MAX_SIZE 32 + /****************************** TYPES ******************************/ /* --------------------------- SUBTYPES --------------------------- */ @@ -266,7 +290,7 @@ struct iwreq caddr_t pointer; /* Pointer to the data * (in user space) */ __u16 length; /* fields or byte size */ - __u16 flags; /* Unused */ + __u16 flags; /* Optional params */ } data; } u; }; diff --git a/include/linux/zorro.h b/include/linux/zorro.h index d2b68111f..9ec9ca719 100644 --- a/include/linux/zorro.h +++ b/include/linux/zorro.h @@ -301,7 +301,7 @@ typedef __u32 zorro_id; #define ZORRO_PROD_BSC_MULTIFACE_I ZORRO_ID(BSC_ALFADATA_3, 0x10, 0) #define ZORRO_PROD_BSC_MULTIFACE_II ZORRO_ID(BSC_ALFADATA_3, 0x11, 0) #define ZORRO_PROD_BSC_MULTIFACE_III ZORRO_ID(BSC_ALFADATA_3, 0x12, 0) -#define ZORRO_PROD_BSC_FRAMEBUFFER ZORRO_ID(BSC_ALFADATA_3, 0x20, 0) +#define ZORRO_PROD_BSC_FRAMEMASTER_II ZORRO_ID(BSC_ALFADATA_3, 0x20, 0) #define ZORRO_PROD_BSC_GRAFFITI_RAM ZORRO_ID(BSC_ALFADATA_3, 0x21, 0) #define ZORRO_PROD_BSC_GRAFFITI_REG ZORRO_ID(BSC_ALFADATA_3, 0x22, 0) #define ZORRO_PROD_BSC_ISDN_MASTERCARD ZORRO_ID(BSC_ALFADATA_3, 0x40, 0) diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 44fb44d2c..d711d0d51 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -53,8 +53,9 @@ extern int addrconf_set_dstaddr(void *arg); extern struct inet6_ifaddr * ipv6_chk_addr(struct in6_addr *addr, struct device *dev, int nd); -extern struct inet6_ifaddr * ipv6_get_saddr(struct dst_entry *dst, - struct in6_addr *daddr); +extern int ipv6_get_saddr(struct dst_entry *dst, + struct in6_addr *daddr, + struct in6_addr *saddr); extern struct inet6_ifaddr * ipv6_get_lladdr(struct device *dev); /* diff --git a/include/net/br.h b/include/net/br.h index c0b69e54a..1210b4e3e 100644 --- a/include/net/br.h +++ b/include/net/br.h @@ -258,6 +258,7 @@ struct br_stat { #define BR_UP 0x0001 /* bridging enabled */ #define BR_DEBUG 0x0002 /* debugging enabled */ #define BR_PROT_STATS 0x0004 /* protocol statistics enabled */ +#define BR_STP_DISABLED 0x0008 /* Spanning tree protocol disabled */ struct br_cf { unsigned int cmd; @@ -281,6 +282,7 @@ struct br_cf { #define BRCMD_ENABLE_PROT_STATS 13 #define BRCMD_DISABLE_PROT_STATS 14 #define BRCMD_ZERO_PROT_STATS 15 +#define BRCMD_TOGGLE_STP 16 /* prototypes of exported bridging functions... */ @@ -295,7 +297,7 @@ struct fdb *br_avl_find_addr(unsigned char addr[6]); struct fdb *br_avl_insert (struct fdb * new_node); void sprintf_avl (char **pbuffer, struct fdb * tree, off_t *pos,int* len, off_t offset, int length); int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy); - +void br_avl_delete_by_port(int port); /* externs */ extern struct br_stat br_stats; diff --git a/include/net/dst.h b/include/net/dst.h index 50b3373dd..baf4f414d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -16,11 +16,7 @@ * 1 - rare events and bugs (default) * 2 - trace mode. */ -#ifdef NO_ANK_FIX #define RT_CACHE_DEBUG 0 -#else -#define RT_CACHE_DEBUG 1 -#endif #define DST_GC_MIN (1*HZ) #define DST_GC_INC (5*HZ) @@ -36,9 +32,10 @@ struct dst_entry struct device *dev; int obsolete; unsigned long lastuse; + unsigned long expires; unsigned mxlock; - unsigned window; unsigned pmtu; + unsigned window; unsigned rtt; unsigned long rate_last; /* rate limiting for ICMP */ unsigned long rate_tokens; @@ -98,6 +95,19 @@ void dst_release(struct dst_entry * dst) atomic_dec(&dst->use); } +/* The following primitive should be use if and only if + destination entry has just been removed from a location + accessed directly by hard irq. + */ +extern __inline__ +void dst_release_irqwait(struct dst_entry * dst) +{ + if (dst) { + synchronize_irq(); + atomic_dec(&dst->use); + } +} + extern __inline__ struct dst_entry * dst_check(struct dst_entry ** dst_p, u32 cookie) { @@ -152,6 +162,17 @@ extern __inline__ void dst_link_failure(struct sk_buff *skb) if (dst && dst->ops && dst->ops->link_failure) dst->ops->link_failure(skb); } + +extern __inline__ void dst_set_expires(struct dst_entry *dst, int timeout) +{ + unsigned long expires = jiffies + timeout; + + if (expires == 0) + expires = 1; + + if (dst->expires == 0 || (long)(dst->expires - expires) > 0) + dst->expires = expires; +} #endif #endif /* _NET_DST_H */ diff --git a/include/net/flow.h b/include/net/flow.h index 45d232fb9..e1ce1b2ae 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -19,10 +19,12 @@ struct flowi { struct { struct in6_addr * daddr; struct in6_addr * saddr; + __u32 flowlabel; } ip6_u; } nl_u; #define fl6_dst nl_u.ip6_u.daddr #define fl6_src nl_u.ip6_u.saddr +#define fl6_flowlabel nl_u.ip6_u.flowlabel #define fl4_dst nl_u.ip4_u.daddr #define fl4_src nl_u.ip4_u.saddr diff --git a/include/net/ip.h b/include/net/ip.h index 52686031e..5e80fb438 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -147,13 +147,14 @@ extern __inline__ int ip_finish_output(struct sk_buff *skb) skb->protocol = __constant_htons(ETH_P_IP); if (hh) { + read_lock_irq(&hh->hh_lock); memcpy(skb->data - 16, hh->hh_data, 16); + read_unlock_irq(&hh->hh_lock); skb_push(skb, dev->hard_header_len); return hh->hh_output(skb); } else if (dst->neighbour) return dst->neighbour->output(skb); - printk(KERN_DEBUG "khm\n"); kfree_skb(skb); return -EINVAL; } diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 905876d00..efd652f28 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -59,6 +59,7 @@ struct rt6_info #define rt6i_dev u.dst.dev #define rt6i_nexthop u.dst.neighbour +#define rt6i_expires u.dst.expires struct fib6_node *rt6i_node; @@ -67,7 +68,6 @@ struct rt6_info u32 rt6i_flags; u32 rt6i_metric; u8 rt6i_hoplimit; - unsigned long rt6i_expires; atomic_t rt6i_ref; union { diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 5c8d6bf8e..6e1fd8690 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -127,6 +127,8 @@ struct fib_table int (*tb_flush)(struct fib_table *table); int (*tb_get_info)(struct fib_table *table, char *buf, int first, int count); + void (*tb_select_default)(struct fib_table *table, + const struct rt_key *key, struct fib_result *res); unsigned char tb_data[0]; }; @@ -156,6 +158,12 @@ extern __inline__ int fib_lookup(const struct rt_key *key, struct fib_result *re return 0; } +extern __inline__ void fib_select_default(const struct rt_key *key, struct fib_result *res) +{ + if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) + main_table->tb_select_default(main_table, key, res); +} + #else /* CONFIG_IP_MULTIPLE_TABLES */ #define local_table (fib_tables[RT_TABLE_LOCAL]) #define main_table (fib_tables[RT_TABLE_MAIN]) @@ -179,6 +187,9 @@ extern __inline__ struct fib_table *fib_new_table(int id) return fib_tables[id] ? : __fib_new_table(id); } + +extern void fib_select_default(const struct rt_key *key, struct fib_result *res); + #endif /* CONFIG_IP_MULTIPLE_TABLES */ /* Exported by fib_frontend.c */ @@ -189,7 +200,7 @@ extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, - struct device *dev, u32 *spec_dst); + struct device *dev, u32 *spec_dst, u32 *itag); extern void fib_select_multipath(const struct rt_key *key, struct fib_result *res); /* Exported by fib_semantics.c */ @@ -227,4 +238,20 @@ extern u32 fib_rules_policy(u32 saddr, struct fib_result *res, unsigned *flags); extern void fib_rules_init(void); #endif +extern __inline__ void fib_combine_itag(u32 *itag, struct fib_result *res) +{ +#ifdef CONFIG_NET_CLS_ROUTE +#ifdef CONFIG_IP_MULTIPLE_TABLES + u32 rtag; +#endif + *itag = FIB_RES_NH(*res).nh_tclassid<<16; +#ifdef CONFIG_IP_MULTIPLE_TABLES + rtag = fib_rules_tclass(res); + if (*itag == 0) + *itag = (rtag<<16); + *itag |= (rtag>>16); +#endif +#endif +} + #endif _NET_FIB_H diff --git a/include/net/ip_masq.h b/include/net/ip_masq.h index 70b627305..9c8e9bf94 100644 --- a/include/net/ip_masq.h +++ b/include/net/ip_masq.h @@ -126,6 +126,7 @@ extern int ip_masq_init(void); */ extern int ip_fw_masquerade(struct sk_buff **, __u32 maddr); extern int ip_fw_masq_icmp(struct sk_buff **, __u32 maddr); +extern int ip_fw_unmasq_icmp(struct sk_buff *); extern int ip_fw_demasquerade(struct sk_buff **); /* diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 118eec2e9..50e2299fb 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -4,7 +4,7 @@ * Authors: * Pedro Roque <roque@di.fc.ul.pt> * - * $Id: ipv6.h,v 1.14 1998/10/03 09:36:45 davem Exp $ + * $Id: ipv6.h,v 1.16 1999/04/22 10:07:27 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -124,6 +124,43 @@ struct ipv6_txoptions /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ }; +struct ip6_flowlabel +{ + struct ip6_flowlabel *next; + u32 label; + struct in6_addr dst; + struct ipv6_txoptions *opt; + atomic_t users; + u32 linger; + u8 share; + u32 owner; + unsigned long lastuse; + unsigned long expires; +}; + +#define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF) +#define IPV6_FLOWLABEL_MASK __constant_htonl(0x000FFFFF) + +struct ipv6_fl_socklist +{ + struct ipv6_fl_socklist *next; + struct ip6_flowlabel *fl; +}; + +extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, u32 label); +extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, + struct ip6_flowlabel * fl, + struct ipv6_txoptions * fopt); +extern void fl6_free_socklist(struct sock *sk); +extern int ipv6_flowlabel_opt(struct sock *sk, char *optval, int optlen); +extern void ip6_flowlabel_init(void); +extern void ip6_flowlabel_cleanup(void); + +extern __inline__ void fl6_sock_release(struct ip6_flowlabel *fl) +{ + if (fl) + atomic_dec(&fl->users); +} extern int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *)); @@ -186,14 +223,6 @@ extern __inline__ int ipv6_addr_any(struct in6_addr *a) a->s6_addr32[2] | a->s6_addr32[3] ) == 0); } -extern __inline__ int gfp_any(void) -{ - int pri = GFP_KERNEL; - if (in_interrupt()) - pri = GFP_ATOMIC; - return pri; -} - /* * Prototypes exported by ipv6 */ diff --git a/include/net/irda/discovery.h b/include/net/irda/discovery.h new file mode 100644 index 000000000..15e254b33 --- /dev/null +++ b/include/net/irda/discovery.h @@ -0,0 +1,66 @@ +/********************************************************************* + * + * Filename: discovery.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Tue Apr 6 16:53:53 1999 + * Modified at: Thu Apr 22 11:04:56 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1999 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ********************************************************************/ + +#ifndef DISCOVERY_H +#define DISCOVERY_H + +#include <asm/param.h> + +#include <net/irda/irda.h> +#include <net/irda/irqueue.h> + +#define DISCOVERY_EXPIRE_TIMEOUT 6*HZ +#define DISCOVERY_DEFAULT_SLOTS 0 + +/* + * The DISCOVERY structure is used for both discovery requests and responses + */ +typedef struct { + QUEUE queue; /* Must be first! */ + + __u32 saddr; /* Which link the device was discovered */ + __u32 daddr; /* Remote device address */ + LAP_REASON condition; /* More info about the discovery */ + + __u16_host_order hints; /* Discovery hint bits */ + __u8 charset; + char info[32]; /* Usually the name of the device */ + __u8 info_len; /* Length of device info field */ + + int gen_addr_bit; /* Need to generate a new device address? */ + int nslots; /* Number of slots to use when discovering */ + int timestamp; /* Time discovered */ +} discovery_t; + +void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *discovery); +void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log); +void irlmp_expire_discoveries(hashbin_t *log, int saddr, int force); + +#endif diff --git a/include/net/irda/dongle.h b/include/net/irda/dongle.h index 8498f4176..d8983c009 100644 --- a/include/net/irda/dongle.h +++ b/include/net/irda/dongle.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Wed Oct 21 22:47:12 1998 - * Modified at: Mon Dec 14 11:47:25 1998 + * Modified at: Sat Feb 6 07:37:49 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli, All Rights Reserved. @@ -34,6 +34,7 @@ typedef enum { ESI_DONGLE, ACTISYS_DONGLE, ACTISYS_PLUS_DONGLE, + GIRBIL_DONGLE, } DONGLE_T; struct dongle { diff --git a/include/net/irda/ircomm_common.h b/include/net/irda/ircomm_common.h index a092d9808..cd1c41f86 100644 --- a/include/net/irda/ircomm_common.h +++ b/include/net/irda/ircomm_common.h @@ -19,14 +19,21 @@ * ********************************************************************/ +#ifndef IRCOMM_H +#define IRCOMM_H + /* #define DEBUG(n, args...) printk( KERN_DEBUG args) */ /* enable all debug message */ #include <linux/types.h> #include <net/irda/irmod.h> typedef enum { - COMM_DISCOVERY, COMM_IDLE, + + COMM_DISCOVERY_WAIT, + COMM_QUERYPARAM_WAIT, + COMM_QUERYLSAP_WAIT, + COMM_WAITI, COMM_WAITR, COMM_CONN, @@ -50,18 +57,31 @@ typedef enum { IRCOMM_DATA_REQUEST, LMP_DATA_INDICATION, IRCOMM_CONTROL_REQUEST, + + DISCOVERY_INDICATION, + GOT_PARAMETERS, + GOT_LSAPSEL, + QUERYIAS_ERROR, + } IRCOMM_EVENT; +typedef enum { + TX_READY, + TX_BUSY, + + IAS_PARAM, + CONTROL_CHANNEL, +} IRCOMM_CMD; + + #define IRCOMM_MAGIC 0x434f4d4d #define COMM_INIT_CTRL_PARAM 3 /* length of initial control parameters */ -#define COMM_CTRL_MIN 1 /* length of clen field */ -#define COMM_HEADER_SIZE (LAP_HEADER+LMP_HEADER+TTP_HEADER+COMM_CTRL_MIN) +#define COMM_HEADER 1 /* length of clen field */ +#define COMM_HEADER_SIZE (LAP_HEADER+LMP_HEADER+TTP_HEADER+COMM_HEADER) #define COMM_DEFAULT_DATA_SIZE 64 -#define IRCOMM_MAX_CONNECTION 1 /* Don't change */ +#define IRCOMM_MAX_CONNECTION 1 /* Don't change for now */ -#define IAS_PARAM 1 -#define CONTROL_CHANNEL 2 @@ -78,7 +98,7 @@ typedef enum { #define SERVICETYPE 0x00 -#define PORT_TYPE 0x02 +#define PORT_TYPE 0x01 #define PORT_NAME 0x02 #define FIXED_PORT_NAME 0x82 @@ -101,10 +121,6 @@ typedef enum { #define IEEE1284_MODE 0x34 #define IEEE1284_ECP_EPP_DATA_TRANSFER 0x35 -#define TX_READY 0xFE /* FIXME: this is not defined in IrCOMM spec */ -#define TX_BUSY 0XFF /* so we should find another way */ - - /* parameters of FLOW_CONTROL */ #define USE_RTS 0x08 /* use RTS on output */ @@ -131,6 +147,20 @@ typedef enum { /* parameters of DATA_FORMAT */ +#define IRCOMM_WLEN5 0x00 /* word length is 5bit */ +#define IRCOMM_WLEN6 0x01 /* word length is 6bit */ +#define IRCOMM_WLEN7 0x02 /* word length is 7bit */ +#define IRCOMM_WLEN8 0x03 /* word length is 8bit */ + +#define IRCOMM_STOP2 0x04 /* 2 stop bits mode */ +#define IRCOMM_PARENB 0x08 /* parity enable */ +#define IRCOMM_PARODD 0x00 /* odd parity */ +#define IRCOMM_PAREVEN 0x10 /* even parity */ +#define IRCOMM_PARMARK 0x20 +#define IRCOMM_PARSPC 0x30 + +/* parameters of LINE_STATUS */ + #define LSR_OE 0x02 /* Overrun error indicator */ #define LSR_PE 0x04 /* Parity error indicator */ #define LSR_FE 0x08 /* Frame error indicator */ @@ -146,30 +176,50 @@ struct ircomm_cb{ int in_use; int null_modem_mode; /* switch for null modem emulation */ int ttp_stop; + int max_txbuff_size; - int maxsdusize; - __u32 daddr; /* Device address of the peer device */ + __u32 maxsdusize; - void (*d_handler)(struct ircomm_cb *self); + __u32 daddr; /* Device address of the peer device */ + __u32 saddr; + __u32 skey; + __u32 ckey; + int queryias_lock; + int ias_type; + int disconnect_priority; /* P_NORMAL or P_HIGH. see irttp.h */ struct notify_t notify; /* container of callbacks */ + void (*d_handler)(struct ircomm_cb *self); + int control_ch_pending; struct sk_buff *ctrl_skb; /* queue of control channel */ + __u8 dlsap; /* IrLMP dlsap */ + __u8 lsap; /* sap of local device */ struct tsap_cb *tsap; /* IrTTP/LMP handle */ struct qos_info *qos; /* Quality of Service */ - int reason; /* I don't know about reason: see Irlmp.c or somewhere :p)*/ + int peer_cap; /* capability of peer device */ + + struct wait_queue *discovery_wait; + struct wait_queue *ias_wait; + + /* statistics */ + int tx_packets; + int rx_packets; + int tx_controls; + int pending_control_tuples; + int ignored_control_tuples; + - __u8 dlsap; /* IrLMP dlsap */ - __u8 lsap; /* sap of local device */ __u8 pi ; /* instruction of control channel*/ + __u8 port_type; __u8 peer_port_type; __u8 servicetype; - __u8 peer_servicetype; + __u8 peer_servicetype; __u8 data_format; __u8 peer_data_format; __u8 flow_ctrl; @@ -199,35 +249,25 @@ struct ircomm_cb{ __u32 data_rate; __u32 peer_data_rate; - char port_name[60]; - + char port_name[33]; + int port_name_critical; }; -void ircomm_connect_request(struct ircomm_cb *self, int maxsdusize); +void ircomm_connect_request(struct ircomm_cb *self, __u8 servicetype); void ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata, - int maxsdusize); + __u32 maxsdusize); void ircomm_disconnect_request(struct ircomm_cb *self, - struct sk_buff *userdata); -void ircomm_data_request(struct ircomm_cb *self, - struct sk_buff *userdata); -void ircomm_control_request(struct ircomm_cb *self); -void ircomm_append_ctrl(struct ircomm_cb *self, __u8 instruction); -struct ircomm_cb *ircomm_attach_cable( __u8 servicetype, struct notify_t notify, - void *handler); -int ircomm_detach_cable(struct ircomm_cb *self); - - -void ircomm_accept_data_indication(void *instance, void *sap, struct sk_buff *skb); -void ircomm_accept_connect_confirm(void *instance, void *sap, struct qos_info *qos, - int maxsdusize, struct sk_buff *skb); -void ircomm_accept_connect_indication(void *instance, void *sap, - struct qos_info *qos, - int maxsdusize, struct sk_buff *skb); -void ircomm_accept_disconnect_indication(void *instance, void *sap, LM_REASON reason, - struct sk_buff *skb); -void ircomm_accept_flow_indication(void *instance, void *sap, LOCAL_FLOW flow); -void ircomm_next_state( struct ircomm_cb *self, IRCOMM_STATE state); + struct sk_buff *userdata, int priority); +int ircomm_data_request(struct ircomm_cb *self, + struct sk_buff *userdata); +void ircomm_control_request(struct ircomm_cb *self, __u8 instruction); + +void ircomm_parse_tuples(struct ircomm_cb *self, struct sk_buff *skb, int type); + +struct ircomm_cb *ircomm_open_instance(struct notify_t notify); +int ircomm_close_instance(struct ircomm_cb *self); +#endif diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h index 22458aa0b..35c15fadc 100644 --- a/include/net/irda/irda.h +++ b/include/net/irda/irda.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Dec 9 21:13:12 1997 - * Modified at: Sat Jan 16 01:23:15 1999 + * Modified at: Wed Apr 21 17:49:00 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli, All Rights Reserved. @@ -22,11 +22,15 @@ * ********************************************************************/ -#ifndef IRDA_H -#define IRDA_H +#ifndef NET_IRDA_H +#define NET_IRDA_H #include <linux/config.h> #include <linux/skbuff.h> +#include <linux/kernel.h> + +#include <net/irda/qos.h> +#include <net/irda/irqueue.h> #ifndef TRUE #define TRUE 1 @@ -39,14 +43,15 @@ #define ALIGN __attribute__((aligned)) #define PACK __attribute__((packed)) -/* use 0 for production, 1 for verification, >2 for debug */ + #ifdef CONFIG_IRDA_DEBUG extern __u32 irda_debug; -#define IRDA_DEBUG 3 +/* use 0 for production, 1 for verification, >2 for debug */ +#define IRDA_DEBUG_LEVEL 0 -#define DEBUG(n, args...) if (irda_debug >= (n)) printk( KERN_DEBUG args) +#define DEBUG(n, args...) if (irda_debug >= (n)) printk(KERN_DEBUG args) #define ASSERT(expr, func) \ if(!(expr)) { \ printk( "Assertion failed! %s,%s,%s,line=%d\n",\ @@ -57,46 +62,11 @@ if(!(expr)) { \ #define ASSERT(expr, func) #endif /* CONFIG_IRDA_DEBUG */ -#ifdef CHECK_SKB -static unsigned int check_skb = CHECK_SKB; - -#define SK_FREED_SKB 0x0DE2C0DE -#define SK_GOOD_SKB 0xDEC0DED1 -#define SK_HEAD_SKB 0x12231298 - -extern int skb_check(struct sk_buff *skb,int,int, char *); - -#ifdef IS_SKB -#undef IS_SKB -#endif - -#define IS_SKB(skb, func) \ -if( skb_check((skb), 0, __LINE__,__FILE__) == -1) { \ - ##func} - -#ifdef IS_SKB_HEAD -#undef IS_SKB_HEAD -#endif - -#define IS_SKB_HEAD(skb) skb_check((skb), 1, __LINE__,__FILE__) - -#define ALLOC_SKB_MAGIC(skb) \ -if( check_skb) \ - skb->magic_debug_cookie = SK_GOOD_SKB; +#define WARNING(args...) printk(KERN_WARNING args) +#define MESSAGE(args...) printk(KERN_INFO args) +#define ERROR(args...) printk(KERN_ERR args) -#define FREE_SKB_MAGIC(skb) \ -if( check_skb) {\ - skb->magic_debug_cookie = SK_FREED_SKB; \ -} - -#else -#undef IS_SKB -#define IS_SKB(skb, func) -#undef IS_SKB_HEAD -#define IS_SKB_HEAD(skb) -#define ALLOC_SKB_MAGIC(skb) -#define FREE_SKB_MAGIC(skb) -#endif /* CHECK_SKB */ +#define MSECS_TO_JIFFIES(ms) (ms*HZ/1000) /* * Magic numbers used by Linux/IR. Random numbers which must be unique to @@ -117,39 +87,155 @@ if( check_skb) {\ #define IAS_OBJECT_MAGIC 0x34234 #define IAS_ATTRIB_MAGIC 0x45232 -#define IAS_DEVICE_ID 0x5342 +#define IAS_DEVICE_ID 0x5342 #define IAS_PNP_ID 0xd342 #define IAS_OBEX_ID 0x34323 #define IAS_IRLAN_ID 0x34234 #define IAS_IRCOMM_ID 0x2343 #define IAS_IRLPT_ID 0x9876 -#endif /* IRDA_H */ - - - - - - - - - - - - - - - - - +typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW; +/* IrDA Socket */ +struct tsap_cb; +struct irda_sock { + __u32 saddr; /* my local address */ + __u32 daddr; /* peer address */ + struct ias_object *ias_obj; + struct tsap_cb *tsap; /* TSAP used by this connection */ + __u8 dtsap_sel; /* remote TSAP address */ + __u8 stsap_sel; /* local TSAP address */ + + __u32 max_sdu_size_rx; + __u32 max_sdu_size_tx; + struct qos_info qos_tx; + __u16 mask; /* Hint bits mask */ + __u16 hints; /* Hint bits */ + __u32 ckey; /* IrLMP client handle */ + __u32 skey; /* IrLMP service handle */ + int nslots; /* Number of slots to use for discovery */ + int errno; + struct sock *sk; + struct wait_queue *ias_wait; /* Wait for LM-IAS answer */ + LOCAL_FLOW tx_flow; + LOCAL_FLOW rx_flow; +}; +/* + * This type is used by the protocols that transmit 16 bits words in + * little endian format. A little endian machine stores MSB of word in + * byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0] + * and LSB in byte[1]. + */ +typedef union { + __u16 word; + __u8 byte[2]; +} __u16_host_order; +/* + * Information monitored by some layers + */ +struct irda_statistics +{ + int rx_packets; /* total packets received */ + int tx_packets; /* total packets transmitted */ + int rx_errors; /* bad packets received */ + int tx_errors; /* packet transmit problems */ + int rx_dropped; /* no space in linux buffers */ + int tx_dropped; /* no space available in linux */ + int rx_compressed; + int tx_compressed; + int rx_bytes; /* total bytes received */ + int tx_bytes; /* total bytes transmitted */ + + int multicast; /* multicast packets received */ + int collisions; + + /* detailed rx_errors: */ + int rx_length_errors; + int rx_over_errors; /* receiver ring buff overflow */ + int rx_crc_errors; /* recved pkt with crc error */ + int rx_frame_errors; /* recv'd frame alignment error */ + int rx_fifo_errors; /* recv'r fifo overrun */ + int rx_missed_errors; /* receiver missed packet */ + + /* detailed tx_errors */ + int tx_aborted_errors; + int tx_carrier_errors; + int tx_fifo_errors; + int tx_heartbeat_errors; + int tx_window_errors; +}; + +/* Misc status information */ +typedef enum { + STATUS_OK, + STATUS_ABORTED, + STATUS_NO_ACTIVITY, + STATUS_NOISY, + STATUS_REMOTE, +} LINK_STATUS; + +typedef enum { + LOCK_NO_CHANGE, + LOCK_LOCKED, + LOCK_UNLOCKED, +} LOCK_STATUS; + +typedef enum { /* FIXME check the two first reason codes */ + LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */ + LAP_NO_RESPONSE, /* To many retransmits without response */ + LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */ + LAP_FOUND_NONE, /* No devices were discovered */ + LAP_MEDIA_BUSY, + LAP_PRIMARY_CONFLICT, +} LAP_REASON; + +/* + * IrLMP disconnect reasons. The order is very important, since they + * correspond to disconnect reasons sent in IrLMP disconnect frames, so + * please do not touch :-) + */ +typedef enum { + LM_USER_REQUEST = 1, /* User request */ + LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */ + LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */ + LM_LAP_RESET, /* IrLAP reset */ + LM_INIT_DISCONNECT, /* Link Management initiated disconnect */ + LM_LSAP_NOTCONN, /* Data delivered on unconnected LSAP */ + LM_NON_RESP_CLIENT, /* Non responsive LM-MUX client */ + LM_NO_AVAIL_CLIENT, /* No available LM-MUX client */ + LM_CONN_HALF_OPEN, /* Connection is half open */ + LM_BAD_SOURCE_ADDR, /* Illegal source address (i.e 0x00) */ +} LM_REASON; +#define LM_UNKNOWN 0xff /* Unspecified disconnect reason */ +/* + * Notify structure used between transport and link management layers + */ +struct notify_t { + int (*data_indication)(void *priv, void *sap, struct sk_buff *skb); + int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb); + void (*connect_confirm)(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, + struct sk_buff *skb); + void (*connect_indication)(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, + struct sk_buff *skb); + void (*disconnect_indication)(void *instance, void *sap, + LM_REASON reason, struct sk_buff *); + void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow); + void *instance; /* Layer instance pointer */ + char name[16]; /* Name of layer */ +}; + +#define NOTIFY_MAX_NAME 16 + +#endif /* NET_IRDA_H */ diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index d8e546bb5..a3dcf2d6e 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Haris Zukanovic <haris@stud.cs.uit.no> * Created at: Tue Apr 14 12:41:42 1998 - * Modified at: Mon Jan 18 10:52:10 1999 + * Modified at: Tue Apr 20 11:06:28 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Haris Zukanovic, <haris@stud.cs.uit.no> @@ -31,15 +31,23 @@ #include <linux/tty.h> #include <linux/netdevice.h> +#include <asm/spinlock.h> + #include <net/irda/irda.h> #include <net/irda/qos.h> #include <net/irda/irqueue.h> - -#define SIR_MODE 0x01 -#define MIR_MODE 0x02 -#define FIR_MODE 0x04 -#define IO_PIO 0x08 -#define IO_DMA 0x10 +#include <net/irda/irlap_frame.h> + +/* Some non-standard interface flags (should not conflict with any in if.h) */ +#define IFF_SIR 0x0001 /* Supports SIR speeds */ +#define IFF_MIR 0x0002 /* Supports MIR speeds */ +#define IFF_FIR 0x0004 /* Supports FIR speeds */ +#define IFF_VFIR 0x0008 /* Supports VFIR speeds */ +#define IFF_PIO 0x0010 /* Supports PIO transfer of data */ +#define IFF_DMA 0x0020 /* Supports DMA transfer of data */ +#define IFF_SHM 0x0040 /* Supports shared memory data transfers */ +#define IFF_DONGLE 0x0080 /* Interface has a dongle attached */ +#define IFF_AIR 0x0100 /* Supports A(dvanced)IR standards */ #define IO_XMIT 0x01 #define IO_RECV 0x02 @@ -48,29 +56,29 @@ struct chipio_t { int iobase, iobase2; /* IO base */ int io_ext, io_ext2; /* Length of iobase */ + int membase; /* Shared memory base */ int irq, irq2; /* Interrupts used */ int fifo_size; /* FIFO size */ int dma, dma2; /* DMA channel used */ int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */ - int direction; /* Used by some FIR drivers */ + int direction; /* Link direction, used by some FIR drivers */ int baudrate; /* Currently used baudrate */ int dongle_id; /* Dongle or transceiver currently used */ }; -/* Buffer specific info */ +/* IO buffer specific info (inspired by struct sk_buff) */ struct iobuff_t { int state; /* Receiving state (transmit state not used) */ int in_frame; /* True if receiving frame */ - __u8 *data; /* the buffer */ - __u8 *head; /* start of data in buffer */ + __u8 *head; /* start of buffer */ + __u8 *data; /* start of data in buffer */ __u8 *tail; /* end of data in buffer */ - int offset; /* Usually data + offset = head */ - int len; /* currently used bytes in buffer */ - int truesize; /* total size of the data area */ + int len; /* length of data */ + int truesize; /* total size of buffer */ __u16 fcs; int flags; /* Allocation flags (GFP_KERNEL | GFP_DMA ) */ @@ -83,7 +91,7 @@ struct iobuff_t { * stuff from IrDA port implementations. */ struct irda_device { - QUEUE q; /* Must be first */ + QUEUE q; /* Must be first */ int magic; /* Our magic bullet */ char name[16]; /* Name of device "irda0" */ @@ -93,7 +101,7 @@ struct irda_device { struct device netdev; /* Yes! we are some kind of netdevice */ struct enet_statistics stats; -/* int flags; */ + int flags; /* Interface flags (see defs above) */ void *priv; /* Pointer to low level implementation */ @@ -103,51 +111,62 @@ struct irda_device { struct iobuff_t tx_buff; struct iobuff_t rx_buff; - int media_busy; + /* spinlock_t lock; */ /* For serializing operations */ /* Media busy stuff */ + int media_busy; struct timer_list media_busy_timer; - struct timer_list todo_timer; - int (*hard_xmit)( struct sk_buff *skb, struct device *dev); - void (*change_speed)( struct irda_device *driver, int baud); - - int (*is_receiving)(struct irda_device *); /* receiving? */ + /* Callbacks for driver specific implementation */ + void (*change_speed)(struct irda_device *driver, int baud); + int (*is_receiving)(struct irda_device *); /* receiving? */ /* int (*is_tbusy)(struct irda_device *); */ /* transmitting? */ void (*wait_until_sent)(struct irda_device *); - - int new_speed; /* Will be removed in future */ + void (*set_caddr)(struct irda_device *); /* Set connection addr */ }; extern hashbin_t *irda_device; /* Function prototypes */ -int irda_device_init( void); -void irda_device_cleanup( void); +int irda_device_init(void); +void irda_device_cleanup(void); -int irda_device_open( struct irda_device *, char *name, void *priv); -void irda_device_close( struct irda_device *); +int irda_device_open(struct irda_device *, char *name, void *priv); +void irda_device_close(struct irda_device *); /* Interface to be uses by IrLAP */ -inline void irda_device_set_media_busy( struct irda_device *, int status); -inline int irda_device_is_media_busy( struct irda_device *); -inline int irda_device_is_receiving( struct irda_device *); -inline void irda_device_change_speed( struct irda_device *, int); - -inline struct qos_info *irda_device_get_qos( struct irda_device *self); -int irda_device_txqueue_empty( struct irda_device *self); +inline void irda_device_set_media_busy(struct irda_device *, int status); +inline int irda_device_is_media_busy(struct irda_device *); +inline int irda_device_is_receiving(struct irda_device *); +inline void irda_device_change_speed(struct irda_device *, int); -int irda_device_setup( struct device *dev); +inline struct qos_info *irda_device_get_qos(struct irda_device *self); +int irda_device_txqueue_empty(struct irda_device *self); -__inline__ int irda_get_mtt( struct sk_buff *skb); - -void setup_dma( int channel, char *buffer, int count, int mode); - -#endif +int irda_device_setup(struct device *dev); +void setup_dma(int channel, char *buffer, int count, int mode); +/* + * Function irda_get_mtt (skb) + * + * Utility function for getting the minimum turnaround time out of + * the skb, where it has been hidden in the cb field. + */ +inline static __u16 irda_get_mtt(struct sk_buff *skb) +{ + __u16 mtt; + if (((struct irlap_skb_cb *)(skb->cb))->magic != LAP_MAGIC) + mtt = 10000; + else + mtt = ((struct irlap_skb_cb *)(skb->cb))->mtt; + ASSERT(mtt <= 10000, return 10000;); + + return mtt; +} +#endif diff --git a/include/net/irda/iriap.h b/include/net/irda/iriap.h index 495da351e..071ed8561 100644 --- a/include/net/irda/iriap.h +++ b/include/net/irda/iriap.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: iriap.h - * Version: + * Version: 0.5 * Description: Information Access Protocol (IAP) * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Aug 21 00:02:07 1997 - * Modified at: Sat Dec 5 13:45:37 1998 + * Modified at: Wed Apr 21 16:37:21 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -34,8 +34,8 @@ #include <net/irda/irqueue.h> #include <net/irda/timer.h> -#define LST 0x80 -#define ACK 0x40 +#define IAP_LST 0x80 +#define IAP_ACK 0x40 #define IAS_SERVER 0 #define IAS_CLIENT 1 @@ -51,27 +51,18 @@ #define IAS_SUCCESS 0 #define IAS_CLASS_UNKNOWN 1 #define IAS_ATTRIB_UNKNOWN 2 +#define IAS_DISCONNECT 10 -typedef void (*CONFIRM_CALLBACK)( __u16 obj_id, struct ias_value *value, - void *priv); - -struct iap_value { - char *full; - char *name; - char *attr; - __u16 obj_id; - __u8 ret_code; - __u8 type; - int len; - int value_int; - char *value_char; -}; +typedef void (*CONFIRM_CALLBACK)(int result, __u16 obj_id, + struct ias_value *value, void *priv); struct iriap_cb { QUEUE queue; /* Must be first */ int magic; /* Magic cookie */ int mode; /* Client or server */ + + __u32 saddr; __u32 daddr; __u8 operation; @@ -95,19 +86,15 @@ struct iriap_cb { int iriap_init(void); void iriap_cleanup(void); -void iriap_getvaluebyclass_request( __u32 addr, char *name, char *attr, +void iriap_getvaluebyclass_request( char *name, char *attr, + __u32 saddr, __u32 daddr, CONFIRM_CALLBACK callback, void *priv); -void iriap_getvaluebyclass_confirm( struct iriap_cb *self, - struct sk_buff *skb); +void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb); void iriap_send_ack( struct iriap_cb *self); -void iriap_data_indication( void *instance, void *sap, struct sk_buff *skb); -void iriap_connect_confirm( void *instance, void *sap, struct qos_info *qos, - int max_sdu_size, struct sk_buff *skb); -void iriap_connect_indication( void *instance, void *sap, - struct qos_info *qos, int max_sdu_size, - struct sk_buff *skb); -void iriap_call_indication( struct iriap_cb *self, struct sk_buff *skb); +void iriap_connect_confirm(void *instance, void *sap, struct qos_info *qos, + __u32 max_sdu_size, struct sk_buff *skb); +void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb); void iriap_register_server(void); @@ -121,3 +108,5 @@ static inline void iriap_start_watchdog_timer( struct iriap_cb *self, } #endif + + diff --git a/include/net/irda/irias_object.h b/include/net/irda/irias_object.h index efacac854..4a76018b6 100644 --- a/include/net/irda/irias_object.h +++ b/include/net/irda/irias_object.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Oct 1 22:49:50 1998 - * Modified at: Sun Oct 25 00:28:56 1998 + * Modified at: Wed Feb 3 10:38:02 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli, All Rights Reserved. @@ -25,7 +25,7 @@ #ifndef LM_IAS_OBJECT_H #define LM_IAS_OBJECT_H -#include "irqueue.h" +#include <net/irda/irqueue.h> /* LM-IAS Attribute types */ #define IAS_MISSING 0 @@ -38,12 +38,10 @@ */ struct ias_object { QUEUE queue; /* Must be first! */ - int magic; char *name; int id; - hashbin_t *attribs; }; @@ -51,8 +49,7 @@ struct ias_object { * Values used by LM-IAS attributes */ struct ias_value { - /* Value description */ - __u8 type; + __u8 type; /* Value description */ int charset; /* Only used by string type */ int len; @@ -68,16 +65,11 @@ struct ias_value { * Attributes used by LM-IAS objects */ struct ias_attrib { - QUEUE queue; /* Must be first! */ - + QUEUE queue; /* Must be first! */ int magic; - /* Attribute name */ - char *name; - /* char *attr; What do we need this for? */ - - /* Attribute value */ - struct ias_value *value; + char *name; /* Attribute name */ + struct ias_value *value; /* Attribute value */ }; char *strdup( char *str); @@ -87,12 +79,12 @@ void irias_insert_object( struct ias_object *obj); void __irias_delete_object( struct ias_object *obj); void irias_delete_object( char *name); -void irias_add_integer_attrib( struct ias_object *obj, char *name, - int value); -void irias_add_string_attrib( struct ias_object *obj, char *name, - char *value); -void irias_add_octseq_attrib( struct ias_object *obj, char *name, - __u8 *octets, int len); +void irias_add_integer_attrib(struct ias_object *obj, char *name, int value); +void irias_add_string_attrib(struct ias_object *obj, char *name, char *value); +void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets, + int len); +int irias_object_change_attribute(char *obj_name, char *attrib_name, + struct ias_value *new_value); struct ias_object *irias_find_object( char *name); struct ias_attrib *irias_find_attrib( struct ias_object *obj, char *name); diff --git a/include/net/irda/irlan_cli.h b/include/net/irda/irlan_cli.h deleted file mode 100644 index fb677af20..000000000 --- a/include/net/irda/irlan_cli.h +++ /dev/null @@ -1,65 +0,0 @@ -/********************************************************************* - * - * Filename: client.h - * Version: 0.3 - * Description: IrDA LAN access layer - * Status: Experimental. - * Author: Dag Brattli <dagb@cs.uit.no> - * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Mon Oct 19 12:37:20 1998 - * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is - * provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRLAN_CLIENT_H -#define IRLAN_CLIENT_H - -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/netdevice.h> - -int irlan_client_init(void); -void irlan_client_cleanup(void); - -void irlan_discovery_indication( DISCOVERY*); -void irlan_client_disconnect_indication( void *instance, void *sap, - LM_REASON reason, struct sk_buff *); - -void irlan_client_data_indication( void *instance, void *sap, - struct sk_buff *skb); - -void irlan_client_control_data_indication( void *instance, void *sap, - struct sk_buff *skb); - -void irlan_client_connect_confirm( void *instance, void *sap, - struct qos_info *qos, int max_sdu_size, - struct sk_buff *); -void irlan_client_connect_indication( void *instance, void *sap, - struct sk_buff *); -void irlan_client_connect_response( void *instance, void *sap, - int max_sdu_size, struct sk_buff *skb); - -void irlan_client_open_tsaps( struct irlan_cb *self); - -void irlan_client_extract_params( struct irlan_cb *self, - struct sk_buff *skb); -void check_response_param( struct irlan_cb *self, char *param, - char *value, int val_len); -void handle_request( struct irlan_cb *self); -void irlan_client_register_server(void); -void irlan_client_get_value_confirm( __u16 obj_id, struct ias_value *value, - void *priv); - -#endif diff --git a/include/net/irda/irlan_client.h b/include/net/irda/irlan_client.h new file mode 100644 index 000000000..62ea6157a --- /dev/null +++ b/include/net/irda/irlan_client.h @@ -0,0 +1,45 @@ +/********************************************************************* + * + * Filename: irlan_client.h + * Version: 0.3 + * Description: IrDA LAN access layer + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 31 20:14:37 1997 + * Modified at: Thu Apr 22 14:13:34 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsø admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAN_CLIENT_H +#define IRLAN_CLIENT_H + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/skbuff.h> +#include <linux/netdevice.h> + +#include <net/irda/irias_object.h> +#include <net/irda/irlan_event.h> + +void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout); +void irlan_client_discovery_indication(discovery_t *); +void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr); + +void irlan_client_open_ctrl_tsap( struct irlan_cb *self); + +void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb); +void irlan_client_get_value_confirm(int result, __u16 obj_id, + struct ias_value *value, void *priv); +#endif diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h index 33ba52377..35d83096f 100644 --- a/include/net/irda/irlan_common.h +++ b/include/net/irda/irlan_common.h @@ -1,12 +1,12 @@ /********************************************************************* * - * Filename: irlan.h - * Version: 0.1 + * Filename: irlan_common.h + * Version: 0.8 * Description: IrDA LAN access layer * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Thu Oct 29 13:23:11 1998 + * Modified at: Thu Apr 22 14:30:37 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -25,15 +25,18 @@ #ifndef IRLAN_H #define IRLAN_H +#include <asm/param.h> /* for HZ */ + #include <linux/kernel.h> #include <linux/types.h> #include <linux/skbuff.h> #include <linux/netdevice.h> -#include "irqueue.h" -#include "irttp.h" +#include <net/irda/irqueue.h> +#include <net/irda/irttp.h> -#define IRLAN_MTU 1518 +#define IRLAN_MTU 1518 +#define IRLAN_TIMEOUT 10*HZ /* 10 seconds */ /* Command packet types */ #define CMD_GET_PROVIDER_INFO 0 @@ -61,23 +64,23 @@ #define MEDIA_802_5 2 /* Filter parameters */ -#define DATA_CHAN 1 +#define DATA_CHAN 1 #define FILTER_TYPE 2 #define FILTER_MODE 3 /* Filter types */ -#define IR_DIRECTED 1 -#define IR_FUNCTIONAL 2 -#define IR_GROUP 3 -#define IR_MAC_FRAME 4 -#define IR_MULTICAST 5 -#define IR_BROADCAST 6 -#define IR_IPX_SOCKET 7 +#define IRLAN_DIRECTED 0x01 +#define IRLAN_FUNCTIONAL 0x02 +#define IRLAN_GROUP 0x04 +#define IRLAN_MAC_FRAME 0x08 +#define IRLAN_MULTICAST 0x10 +#define IRLAN_BROADCAST 0x20 +#define IRLAN_IPX_SOCKET 0x40 /* Filter modes */ -#define ALL 1 -#define FILTER 2 -#define NONE 3 +#define ALL 1 +#define FILTER 2 +#define NONE 3 /* Filter operations */ #define GET 1 @@ -87,36 +90,50 @@ #define DYNAMIC 5 /* Access types */ -#define DIRECT 1 -#define PEER 2 -#define HOSTED 3 +#define ACCESS_DIRECT 1 +#define ACCESS_PEER 2 +#define ACCESS_HOSTED 3 + +#define IRLAN_BYTE 0 +#define IRLAN_SHORT 1 +#define IRLAN_ARRAY 2 #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER) /* - * IrLAN client subclass + * IrLAN client */ struct irlan_client_cb { - /* - * Client fields - */ + int state; + int open_retries; + + struct tsap_cb *tsap_ctrl; __u8 reconnect_key[255]; __u8 key_len; + __u16 recv_arb_val; + __u16 max_frame; + int filter_type; + int unicast_open; int broadcast_open; + + struct timer_list kick_timer; }; /* - * IrLAN servers subclass + * IrLAN provider */ -struct irlan_server_cb { +struct irlan_provider_cb { + int state; + struct tsap_cb *tsap_ctrl; + /* - * Store some values here which are used by the irlan_server to parse - * FILTER_OPERATIONs + * Store some values here which are used by the provider to parse + * the filter operations */ int data_chan; int filter_type; @@ -124,11 +141,13 @@ struct irlan_server_cb { int filter_operation; int filter_entry; + __u16 send_arb_val; + __u8 mac_address[6]; /* Generated MAC address for peer device */ }; /* - * IrLAN super class + * IrLAN */ struct irlan_cb { QUEUE queue; /* Must be first */ @@ -140,57 +159,56 @@ struct irlan_cb { __u32 saddr; /* Source devcie address */ __u32 daddr; /* Destination device address */ - int connected; /* TTP layer ready to exchange ether frames */ + int netdev_registered; + int notify_irmanager; - int state; /* Current state of IrLAN layer */ - - int media; + int media; /* Media type */ + int access_type; /* Currently used access type */ + __u8 version[2]; /* IrLAN version */ - struct tsap_cb *tsap_ctrl; struct tsap_cb *tsap_data; int use_udata; /* Use Unit Data transfers */ - __u8 dtsap_sel_data; /* Destination data TSAP selector */ __u8 stsap_sel_data; /* Source data TSAP selector */ + __u8 dtsap_sel_data; /* Destination data TSAP selector */ __u8 dtsap_sel_ctrl; /* Destination ctrl TSAP selector */ - int client; /* Client or server */ - union { - struct irlan_client_cb client; - struct irlan_server_cb server; - } t; - - /* void (*irlan_dev_init)(struct irlan_cb *); */ - - /* - * Used by extract_params, placed here for now to avoid placing - * them on the stack. FIXME: remove these! - */ - char name[255]; - char value[1016]; + struct irlan_client_cb client; /* Client specific fields */ + struct irlan_provider_cb provider; /* Provider specific fields */ + + struct timer_list watchdog_timer; }; -struct irlan_cb *irlan_open(void); - -void irlan_get_provider_info( struct irlan_cb *self); -void irlan_get_unicast_addr( struct irlan_cb *self); -void irlan_get_media_char( struct irlan_cb *self); -void irlan_open_data_channel( struct irlan_cb *self); -void irlan_set_multicast_filter( struct irlan_cb *self, int status); -void irlan_set_broadcast_filter( struct irlan_cb *self, int status); -void irlan_open_unicast_addr( struct irlan_cb *self); - -int insert_byte_param( struct sk_buff *skb, char *param, __u8 value); -int insert_string_param( struct sk_buff *skb, char *param, char *value); -int insert_array_param( struct sk_buff *skb, char *name, __u8 *value, - __u16 value_len); - -int insert_param( struct sk_buff *skb, char *param, int type, char *value_char, - __u8 value_byte, __u16 value_short); - -int irlan_get_response_param( __u8 *buf, char *name, char *value, int *len); -void print_ret_code( __u8 code); +struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr, int netdev); +void irlan_close(struct irlan_cb *self); +void irlan_close_tsaps(struct irlan_cb *self); +void irlan_mod_inc_use_count(void); +void irlan_mod_dec_use_count(void); + +int irlan_register_netdev(struct irlan_cb *self); +void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel); +void irlan_start_watchdog_timer(struct irlan_cb *self, int timeout); + +void irlan_open_data_tsap(struct irlan_cb *self); + +void irlan_get_provider_info(struct irlan_cb *self); +void irlan_get_unicast_addr(struct irlan_cb *self); +void irlan_get_media_char(struct irlan_cb *self); +void irlan_open_data_channel(struct irlan_cb *self); +void irlan_close_data_channel(struct irlan_cb *self); +void irlan_set_multicast_filter(struct irlan_cb *self, int status); +void irlan_set_broadcast_filter(struct irlan_cb *self, int status); +void irlan_open_unicast_addr(struct irlan_cb *self); + +int irlan_insert_byte_param(struct sk_buff *skb, char *param, __u8 value); +int irlan_insert_short_param(struct sk_buff *skb, char *param, __u16 value); +int irlan_insert_string_param(struct sk_buff *skb, char *param, char *value); +int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *value, + __u16 value_len); + +int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len); +void print_ret_code(__u8 code); extern hashbin_t *irlan; diff --git a/include/net/irda/irlan_eth.h b/include/net/irda/irlan_eth.h index 72f14ff75..6ad33ee48 100644 --- a/include/net/irda/irlan_eth.h +++ b/include/net/irda/irlan_eth.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Oct 15 08:36:58 1998 - * Modified at: Thu Oct 15 12:28:12 1998 + * Modified at: Thu Apr 22 14:09:37 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli, All Rights Reserved. @@ -25,12 +25,11 @@ #ifndef IRLAN_ETH_H #define IRLAN_ETH_H -int irlan_eth_init( struct device *dev); -int irlan_eth_open( struct device *dev); -int irlan_eth_close( struct device *dev); - -void irlan_eth_rx( void *instance, void *sap, struct sk_buff *skb); -int irlan_eth_tx( struct sk_buff *skb, struct device *dev); +int irlan_eth_init(struct device *dev); +int irlan_eth_open(struct device *dev); +int irlan_eth_close(struct device *dev); +int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb); +int irlan_eth_xmit(struct sk_buff *skb, struct device *dev); void irlan_eth_flow_indication( void *instance, void *sap, LOCAL_FLOW flow); diff --git a/include/net/irda/irlan_event.h b/include/net/irda/irlan_event.h index d3a062af0..b9baac9eb 100644 --- a/include/net/irda/irlan_event.h +++ b/include/net/irda/irlan_event.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Tue Oct 20 09:59:31 1998 + * Modified at: Tue Feb 2 09:45:17 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -44,7 +44,6 @@ typedef enum { IRLAN_SYNC } IRLAN_STATE; -/* IrLAN Client Events */ typedef enum { IRLAN_DISCOVERY_INDICATION, IRLAN_IAS_PROVIDER_AVAIL, @@ -61,26 +60,22 @@ typedef enum { IRLAN_GET_MEDIA_CMD, IRLAN_OPEN_DATA_CMD, IRLAN_FILTER_CONFIG_CMD, -} IRLAN_EVENT; -struct irlan_info { - __u8 dlsap_sel; - __u32 daddr; - struct tsap_cb *tsap; -}; + IRLAN_CHECK_CON_ARB, + IRLAN_PROVIDER_SIGNAL, + + IRLAN_WATCHDOG_TIMEOUT, +} IRLAN_EVENT; extern char *irlan_state[]; -void irlan_do_client_event( struct irlan_cb *self, - IRLAN_EVENT event, - struct sk_buff *skb); +void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb); -void irlan_do_server_event( struct irlan_cb *self, - IRLAN_EVENT event, - struct sk_buff *skb, - struct irlan_info *info); +void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb); -void irlan_next_state( struct irlan_cb *self, - IRLAN_STATE state); +void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state); +void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state); #endif diff --git a/include/net/irda/irlan_filter.h b/include/net/irda/irlan_filter.h new file mode 100644 index 000000000..b68eec161 --- /dev/null +++ b/include/net/irda/irlan_filter.h @@ -0,0 +1,33 @@ +/********************************************************************* + * + * Filename: irlan_filter.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Fri Jan 29 15:24:08 1999 + * Modified at: Sun Feb 7 23:35:31 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsø admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAN_FILTER_H +#define IRLAN_FILTER_H + +void irlan_check_command_param(struct irlan_cb *self, char *param, + char *value); +void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb); +int irlan_print_filter(int filter_type, char *buf); + +#endif /* IRLAN_FILTER_H */ diff --git a/include/net/irda/irlan_srv.h b/include/net/irda/irlan_provider.h index c187302e2..aafbf9141 100644 --- a/include/net/irda/irlan_srv.h +++ b/include/net/irda/irlan_provider.h @@ -1,12 +1,12 @@ /********************************************************************* * - * Filename: server.h + * Filename: irlan_provider.h * Version: 0.1 * Description: IrDA LAN access layer * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Fri Oct 16 11:25:37 1998 + * Modified at: Thu Apr 22 14:29:16 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -32,31 +32,27 @@ #include <net/irda/irlan_common.h> -int irlan_server_init(void); -void irlan_server_cleanup(void); -struct irlan_cb *irlan_server_open(void); -void irlan_server_close( struct irlan_cb *self); +void irlan_provider_ctrl_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *skb); -void irlan_server_disconnect_indication( void *instance, void *sap, - LM_REASON reason, +void irlan_provider_ctrl_data_indication(void *instance, void *sap, struct sk_buff *skb); -void irlan_server_data_indication( void *instance, void *sap, - struct sk_buff *skb); -void irlan_server_control_data_indication( void *instance, void *sap, - struct sk_buff *skb); +void irlan_provider_connect_indication(void *instance, void *sap, + struct qos_info *qos, + __u32 max_sdu_size, + struct sk_buff *skb); +void irlan_provider_connect_response(struct irlan_cb *, struct tsap_cb *); -void irlan_server_connect_indication( void *instance, void *sap, - struct qos_info *qos, int max_sdu_size, - struct sk_buff *skb); -void irlan_server_connect_response( struct irlan_cb *, struct tsap_cb *); +int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb); +int irlan_provider_parse_command(struct irlan_cb *self, int cmd, + struct sk_buff *skb); -int irlan_parse_open_data_cmd( struct irlan_cb *self, struct sk_buff *skb); -int irlan_server_extract_params( struct irlan_cb *self, int cmd, - struct sk_buff *skb); - -void irlan_server_send_reply( struct irlan_cb *self, int command, - int ret_code); -void irlan_server_register(void); +void irlan_provider_send_reply(struct irlan_cb *self, int command, + int ret_code); +int irlan_provider_open_ctrl_tsap(struct irlan_cb *self); #endif + + diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index 524d2b799..f3b26110f 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: irlap.h - * Version: 0.3 + * Version: 0.8 * Description: An IrDA LAP driver for Linux * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Sat Dec 12 12:25:33 1998 + * Modified at: Fri Apr 23 09:51:15 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -105,6 +105,7 @@ struct irlap_cb { struct timer_list backoff_timer; /* Timeouts which will be different with different turn time */ + int slot_timeout; int poll_timeout; int final_timeout; int wd_timeout; @@ -118,14 +119,15 @@ struct irlap_cb { int retry_count; /* Times tried to establish connection */ int add_wait; /* True if we are waiting for frame */ + __u8 connect_pending; + __u8 disconnect_pending; + + /* To send a faster RR if tx queue empty */ #ifdef CONFIG_IRDA_FAST_RR - /* - * To send a faster RR if tx queue empty - */ int fast_RR_timeout; int fast_RR; #endif - + int N1; /* N1 * F-timer = Negitiated link disconnect warning threshold */ int N2; /* N2 * F-timer = Negitiated link disconnect time */ int N3; /* Connection retry count */ @@ -155,23 +157,19 @@ struct irlap_cb { int discovery_count; hashbin_t *discovery_log; - DISCOVERY *discovery_cmd; + discovery_t *discovery_cmd; struct qos_info qos_tx; /* QoS requested by peer */ struct qos_info qos_rx; /* QoS requested by self */ struct notify_t notify; /* Callbacks to IrLMP */ - int mtt_required; /* Minumum turnaround time required */ - int xbofs_delay; /* Nr of XBOF's used to MTT */ - int bofs_count; /* Negotiated extra BOFs */ + int mtt_required; /* Minumum turnaround time required */ + int xbofs_delay; /* Nr of XBOF's used to MTT */ + int bofs_count; /* Negotiated extra BOFs */ struct irda_statistics stats; -#ifdef CONFIG_IRDA_RECYCLE_RR - struct sk_buff *recycle_rr_skb; -#endif - #ifdef CONFIG_IRDA_COMPRESSION struct irda_compressor compressor; struct irda_compressor decompressor; @@ -208,9 +206,9 @@ void irlap_status_indication( int quality_of_link); void irlap_test_request( __u8 *info, int len); -void irlap_discovery_request( struct irlap_cb *, DISCOVERY *discovery); -void irlap_discovery_confirm( struct irlap_cb *, hashbin_t *discovery_log); -void irlap_discovery_indication( struct irlap_cb *, DISCOVERY *discovery); +void irlap_discovery_request(struct irlap_cb *, discovery_t *discovery); +void irlap_discovery_confirm(struct irlap_cb *, hashbin_t *discovery_log); +void irlap_discovery_indication(struct irlap_cb *, discovery_t *discovery); void irlap_reset_indication( struct irlap_cb *self); void irlap_reset_confirm(void); @@ -221,12 +219,12 @@ int irlap_validate_ns_received( struct irlap_cb *, int ns); int irlap_generate_rand_time_slot( int S, int s); void irlap_initiate_connection_state( struct irlap_cb *); -void irlap_flush_all_queues( struct irlap_cb *); -void irlap_change_speed( struct irlap_cb *, int); -void irlap_wait_min_turn_around( struct irlap_cb *, struct qos_info *); +void irlap_flush_all_queues(struct irlap_cb *); +void irlap_change_speed(struct irlap_cb *, int); +void irlap_wait_min_turn_around(struct irlap_cb *, struct qos_info *); -void irlap_init_qos_capabilities( struct irlap_cb *, struct qos_info *); -void irlap_apply_default_connection_parameters( struct irlap_cb *self); -void irlap_apply_connection_parameters( struct irlap_cb *, struct qos_info *); +void irlap_init_qos_capabilities(struct irlap_cb *, struct qos_info *); +void irlap_apply_default_connection_parameters(struct irlap_cb *self); +void irlap_apply_connection_parameters(struct irlap_cb *, struct qos_info *); #endif diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h index bf4128939..015814b45 100644 --- a/include/net/irda/irlap_event.h +++ b/include/net/irda/irlap_event.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Aug 16 00:59:29 1997 - * Modified at: Thu Dec 17 11:58:10 1998 + * Modified at: Tue Apr 6 17:10:38 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -25,7 +25,8 @@ #ifndef IRLAP_EVENT_H #define IRLAP_EVENT_H -#include "irmod.h" +#include <net/irda/irda.h> +#include <net/irda/discovery.h> struct irlap_cb; @@ -67,6 +68,7 @@ typedef enum { RECV_DISCOVERY_XID_RSP, RECV_SNRM_CMD, RECV_TEST_CMD, + RECV_TEST_RSP, RECV_UA_RSP, RECV_DM_RSP, RECV_I_CMD, @@ -108,10 +110,10 @@ struct irlap_info { int slot; /* Random chosen slot */ int s; /* Current slot */ - DISCOVERY *discovery; /* Discovery information */ + discovery_t *discovery; /* Discovery information */ }; -extern char *irlap_state[]; +extern const char *irlap_state[]; void irlap_do_event( struct irlap_cb *self, IRLAP_EVENT event, struct sk_buff *skb, struct irlap_info *info); diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h index 6b661e4b5..7425b41b4 100644 --- a/include/net/irda/irlap_frame.h +++ b/include/net/irda/irlap_frame.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: irlap_frame.h - * Version: 0.3 + * Version: 0.9 * Description: Build and transmit IrLAP frames * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Aug 19 10:27:26 1997 - * Modified at: Mon Dec 14 14:22:23 1998 + * Modified at: Fri Apr 23 09:33:55 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -27,7 +27,7 @@ #include <linux/skbuff.h> -#include <net/irda/irmod.h> +#include <net/irda/irda.h> #include <net/irda/irlap.h> #include <net/irda/qos.h> @@ -59,81 +59,69 @@ #define I_FRAME 0x00 /* Information Format */ #define UI_FRAME 0x03 /* Unnumbered Information */ -#define CMD_FRAME 0x01 -#define RSP_FRAME 0x00 +#define CMD_FRAME 0x01 +#define RSP_FRAME 0x00 -#define PF_BIT 0x10 /* Poll/final bit */ - -#define IR_S 0x01 /* Supervisory frames */ -#define IR_RR 0x01 /* Receiver ready */ -#define IR_RNR 0x05 /* Receiver not ready */ -#define IR_REJ 0x09 /* Reject */ -#define IR_U 0x03 /* Unnumbered frames */ -#define IR_SNRM 0x2f /* Set Asynchronous Balanced Mode */ - -#define IR_DISC 0x43 /* Disconnect */ -#define IR_DM 0x0f /* Disconnected mode */ -#define IR_UA 0x63 /* Unnumbered acknowledge */ -#define IR_FRMR 0x87 /* Frame reject */ -#define IR_UI 0x03 /* Unnumbered information */ +#define PF_BIT 0x10 /* Poll/final bit */ struct xid_frame { - __u8 caddr __attribute__((packed)); /* Connection address */ - __u8 control __attribute__((packed)); - __u8 ident __attribute__((packed)); /* Should always be XID_FORMAT */ - __u32 saddr __attribute__((packed)); /* Source device address */ - __u32 daddr __attribute__((packed)); /* Destination device address */ - __u8 flags __attribute__((packed)); /* Discovery flags */ - __u8 slotnr __attribute__((packed)); - __u8 version __attribute__((packed)); - __u8 discovery_info[0] __attribute__((packed)); -}; + __u8 caddr; /* Connection address */ + __u8 control; + __u8 ident; /* Should always be XID_FORMAT */ + __u32 saddr; /* Source device address */ + __u32 daddr; /* Destination device address */ + __u8 flags; /* Discovery flags */ + __u8 slotnr; + __u8 version; + __u8 discovery_info[0]; +} PACK; struct test_frame { __u8 caddr; /* Connection address */ __u8 control; - __u8 saddr; /* Source device address */ - __u8 daddr; /* Destination device address */ - __u8 *info; /* Information */ -}; + __u32 saddr; /* Source device address */ + __u32 daddr; /* Destination device address */ + __u8 info[0]; /* Information */ +} PACK; struct ua_frame { - __u8 caddr __attribute__((packed)); - __u8 control __attribute__((packed)); + __u8 caddr; + __u8 control; - __u32 saddr __attribute__((packed)); /* Source device address */ - __u32 daddr __attribute__((packed)); /* Dest device address */ + __u32 saddr; /* Source device address */ + __u32 daddr; /* Dest device address */ __u8 params[0]; -}; +} PACK; struct i_frame { - __u8 caddr __attribute__((packed)); - __u8 control __attribute__((packed)); - __u8 data[0] __attribute__((packed)); -}; + __u8 caddr; + __u8 control; + __u8 data[0]; +} PACK; struct snrm_frame { - __u8 caddr __attribute__((packed)); - __u8 control __attribute__((packed)); - __u32 saddr __attribute__((packed)); - __u32 daddr __attribute__((packed)); - __u8 ncaddr __attribute__((packed)); + __u8 caddr; + __u8 control; + __u32 saddr; + __u32 daddr; + __u8 ncaddr; __u8 params[0]; -}; +} PACK; /* Per-packet information we need to hide inside sk_buff */ struct irlap_skb_cb { + int magic; /* Be sure that we can trust the information */ int mtt; /* minimum turn around time */ int xbofs; /* number of xbofs required */ int vs; /* next frame to send */ int vr; /* next frame to receive */ }; -__inline__ void irlap_insert_mtt( struct irlap_cb *self, struct sk_buff *skb); - void irlap_send_discovery_xid_frame( struct irlap_cb *, int S, __u8 s, - __u8 command, DISCOVERY *discovery); + __u8 command, discovery_t *discovery); void irlap_send_snrm_frame( struct irlap_cb *, struct qos_info *); +void irlap_send_test_frame(struct irlap_cb *self, __u32 daddr, + struct sk_buff *cmd); void irlap_send_ua_response_frame( struct irlap_cb *, struct qos_info *); void irlap_send_ui_frame( struct irlap_cb *self, struct sk_buff *skb, int command); @@ -150,6 +138,4 @@ void irlap_resend_rejected_frames( struct irlap_cb *, int command); void irlap_send_i_frame( struct irlap_cb *, struct sk_buff *, int command); void irlap_send_ui_frame( struct irlap_cb *, struct sk_buff *, int command); -/* void irlap_input( struct irlap_cb *self, struct sk_buff *skb); */ - #endif diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index a10a08fe1..31785883a 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: irlmp.h - * Version: 0.3 + * Version: 0.9 * Description: IrDA Link Management Protocol (LMP) layer * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 17 20:54:32 1997 - * Modified at: Mon Dec 7 21:11:32 1998 + * Modified at: Fri Apr 23 09:15:07 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -25,20 +25,25 @@ #ifndef IRLMP_H #define IRLMP_H +#include <asm/param.h> /* for HZ */ + #include <linux/config.h> #include <linux/types.h> -#include "irmod.h" -#include "qos.h" -#include "irlap.h" -#include "irlmp_event.h" -#include "irqueue.h" +#include <net/irda/irda.h> +#include <net/irda/qos.h> +#include <net/irda/irlap.h> +#include <net/irda/irlmp_event.h> +#include <net/irda/irqueue.h> +#include <net/irda/discovery.h> /* LSAP-SEL's */ #define LSAP_MASK 0x7f #define LSAP_IAS 0x00 #define LSAP_ANY 0xff +#define DEV_ADDR_ANY 0xffffffff + /* Predefined LSAPs used by the various servers */ #define TSAP_IRLAN 0x05 #define LSAP_IRLPT 0x06 @@ -51,23 +56,7 @@ #define LM_MAX_CONNECTIONS 10 -/* Hint bit positions for first hint byte */ -#define HINT_PNP 0x01 -#define HINT_PDA 0x02 -#define HINT_COMPUTER 0x04 -#define HINT_PRINTER 0x08 -#define HINT_MODEM 0x10 -#define HINT_FAX 0x20 -#define HINT_LAN 0x40 -#define HINT_EXTENSION 0x80 - -/* Hint bit positions for second hint byte (first extension byte) */ -#define HINT_TELEPHONY 0x01 -#define HINT_FILE_SERVER 0x02 -#define HINT_COMM 0x04 -#define HINT_MESSAGE 0x08 -#define HINT_HTTP 0x10 -#define HINT_OBEX 0x20 +#define LM_IDLE_TIMEOUT 2*HZ /* 2 seconds for now */ typedef enum { S_PNP, @@ -80,23 +69,27 @@ typedef enum { S_TELEPHONY, S_COMM, S_OBEX, + S_ANY, + S_END, } SERVICE; -#define S_END 0xff +typedef void (*DISCOVERY_CALLBACK1) (discovery_t *); +typedef void (*DISCOVERY_CALLBACK2) (hashbin_t *); -#define CLIENT 1 -#define SERVER 2 +typedef struct { + QUEUE queue; /* Must be first */ -typedef void (*DISCOVERY_CALLBACK) ( DISCOVERY*); + __u16 hints; /* Hint bits */ +} irlmp_service_t; -struct irlmp_registration { +typedef struct { QUEUE queue; /* Must be first */ - int service; /* LAN, OBEX, COMM etc. */ - int type; /* Client or server or both */ + __u16 hint_mask; - DISCOVERY_CALLBACK discovery_callback; -}; + DISCOVERY_CALLBACK1 callback1; + DISCOVERY_CALLBACK2 callback2; +} irlmp_client_t; struct lap_cb; /* Forward decl. */ @@ -138,18 +131,15 @@ struct lap_cb { IRLMP_STATE lap_state; - struct irlap_cb *irlap; /* Instance of IrLAP layer */ - + struct irlap_cb *irlap; /* Instance of IrLAP layer */ hashbin_t *lsaps; /* LSAP associated with this link */ - __u8 caddr; /* Connection address */ - + __u8 caddr; /* Connection address */ __u32 saddr; /* Source device address */ __u32 daddr; /* Destination device address */ - hashbin_t *cachelog; /* Discovered devices for this link */ - struct qos_info *qos; /* LAP QoS for this session */ + struct timer_list idle_timer; }; /* @@ -171,10 +161,8 @@ struct irlmp_cb { __u8 conflict_flag; - /* int discovery; */ - - DISCOVERY discovery_rsp; /* Discovery response to use by IrLAP */ - DISCOVERY discovery_cmd; /* Discovery command to use by IrLAP */ + discovery_t discovery_cmd; /* Discovery command to use by IrLAP */ + discovery_t discovery_rsp; /* Discovery response to use by IrLAP */ int free_lsap_sel; @@ -185,55 +173,72 @@ struct irlmp_cb { hashbin_t *links; /* IrLAP connection table */ hashbin_t *unconnected_lsaps; - hashbin_t *registry; + hashbin_t *clients; + hashbin_t *services; - __u8 hint[2]; /* Hint bits */ + hashbin_t *cachelog; + int running; + + spinlock_t lock; + + __u16_host_order hints; /* Hint bits */ }; /* Prototype declarations */ int irlmp_init(void); void irlmp_cleanup(void); - struct lsap_cb *irlmp_open_lsap( __u8 slsap, struct notify_t *notify); void irlmp_close_lsap( struct lsap_cb *self); -void irlmp_register_layer( int service, int type, int do_discovery, - DISCOVERY_CALLBACK); -void irlmp_unregister_layer( int service, int type); - -void irlmp_register_irlap( struct irlap_cb *self, __u32 saddr, - struct notify_t *); -void irlmp_unregister_irlap( __u32 saddr); - -void irlmp_connect_request( struct lsap_cb *, __u8 dlsap_sel, __u32 daddr, - struct qos_info *, struct sk_buff *); -void irlmp_connect_indication( struct lsap_cb *self, struct sk_buff *skb); -void irlmp_connect_response( struct lsap_cb *, struct sk_buff *); -void irlmp_connect_confirm( struct lsap_cb *, struct sk_buff *); - - -void irlmp_disconnect_indication( struct lsap_cb *self, LM_REASON reason, - struct sk_buff *userdata); -void irlmp_disconnect_request( struct lsap_cb *, struct sk_buff *userdata); - -void irlmp_discovery_confirm( struct lap_cb *, hashbin_t *discovery_log); -void irlmp_discovery_indication( struct lap_cb *, DISCOVERY *discovery); -void irlmp_discovery_request( int nslots); -DISCOVERY *irlmp_get_discovery_response(void); - -void irlmp_data_request( struct lsap_cb *, struct sk_buff *); -void irlmp_udata_request( struct lsap_cb *, struct sk_buff *); -void irlmp_data_indication( struct lsap_cb *, struct sk_buff *); -void irlmp_udata_indication( struct lsap_cb *, struct sk_buff *); +__u16 irlmp_service_to_hint(int service); +__u32 irlmp_register_service(__u16 hints); +int irlmp_unregister_service(__u32 handle); +__u32 irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 callback1, + DISCOVERY_CALLBACK2 callback2); +int irlmp_unregister_client(__u32 handle); +int irlmp_update_client(__u32 handle, __u16 hint_mask, + DISCOVERY_CALLBACK1, DISCOVERY_CALLBACK2); + +void irlmp_register_link(struct irlap_cb *, __u32 saddr, struct notify_t *); +void irlmp_unregister_link(__u32 saddr); + +int irlmp_connect_request(struct lsap_cb *, __u8 dlsap_sel, + __u32 saddr, __u32 daddr, + struct qos_info *, struct sk_buff *); +void irlmp_connect_indication(struct lsap_cb *self, struct sk_buff *skb); +void irlmp_connect_response(struct lsap_cb *, struct sk_buff *); +void irlmp_connect_confirm(struct lsap_cb *, struct sk_buff *); +struct lsap_cb *irlmp_dup(struct lsap_cb *self, void *instance); + +void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason, + struct sk_buff *userdata); +void irlmp_disconnect_request(struct lsap_cb *, struct sk_buff *userdata); + +void irlmp_discovery_confirm(hashbin_t *discovery_log); +void irlmp_discovery_request(int nslots); +void irlmp_do_discovery(int nslots); +discovery_t *irlmp_get_discovery_response(void); + +void irlmp_data_request(struct lsap_cb *, struct sk_buff *); +inline void irlmp_udata_request(struct lsap_cb *, struct sk_buff *); +inline void irlmp_data_indication(struct lsap_cb *, struct sk_buff *); +inline void irlmp_udata_indication(struct lsap_cb *, struct sk_buff *); void irlmp_status_request(void); -void irlmp_status_indication( LINK_STATUS link, LOCK_STATUS lock); +void irlmp_status_indication(LINK_STATUS link, LOCK_STATUS lock); -int irlmp_slsap_inuse( __u8 slsap); +int irlmp_slsap_inuse(__u8 slsap); __u8 irlmp_find_free_slsap(void); +LM_REASON irlmp_convert_lap_reason(LAP_REASON); -LM_REASON irlmp_convert_lap_reason( LAP_REASON); +__u32 irlmp_get_saddr(struct lsap_cb *self); +__u32 irlmp_get_daddr(struct lsap_cb *self); +extern char *lmp_reasons[]; +extern int sysctl_discovery_slots; +extern int sysctl_discovery; extern struct irlmp_cb *irlmp; +static inline hashbin_t *irlmp_get_cachelog(void) { return irlmp->cachelog; } + #endif diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h index 1ffb6faa5..b83627983 100644 --- a/include/net/irda/irlmp_event.h +++ b/include/net/irda/irlmp_event.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Wed Oct 28 14:58:23 1998 + * Modified at: Thu Feb 25 20:49:16 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -72,7 +72,7 @@ typedef enum { LM_LAP_DISCONNECT_REQUEST, LM_LAP_DISCOVERY_REQUEST, LM_LAP_DISCOVERY_CONFIRM, - + LM_LAP_IDLE_TIMEOUT, } IRLMP_EVENT; /* @@ -92,14 +92,15 @@ struct irlmp_event { int reason; - DISCOVERY *discovery; + discovery_t *discovery; }; -extern char *irlmp_state[]; -extern char *irlsap_state[]; +extern const char *irlmp_state[]; +extern const char *irlsap_state[]; void irlmp_watchdog_timer_expired( unsigned long data); void irlmp_discovery_timer_expired( unsigned long data); +void irlmp_idle_timer_expired( unsigned long data); void irlmp_next_station_state( IRLMP_STATE state); void irlmp_next_lsap_state( struct lsap_cb *self, LSAP_STATE state); diff --git a/include/net/irda/irlmp_frame.h b/include/net/irda/irlmp_frame.h index 64960f31d..d0584f1a7 100644 --- a/include/net/irda/irlmp_frame.h +++ b/include/net/irda/irlmp_frame.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: irlmp_frame.h - * Version: 0.1 + * Version: 0.9 * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Aug 19 02:09:59 1997 - * Modified at: Sun Oct 25 00:30:31 1998 + * Modified at: Tue Apr 6 17:12:57 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -27,31 +27,31 @@ #include <linux/skbuff.h> -/* Frame opcodes */ +#include <net/irda/discovery.h> + +/* IrLMP frame opcodes */ #define CONNECT_CMD 0x01 #define CONNECT_CNF 0x81 #define DISCONNECT 0x02 #define ACCESSMODE_CMD 0x03 #define ACCESSMODE_CNF 0x83 -#define CONTROL_BIT 0x80 +#define CONTROL_BIT 0x80 -inline void irlmp_send_data_pdu( struct lap_cb *self, __u8 dlsap, __u8 slsap, - int expedited, struct sk_buff *skb); -void irlmp_send_lcf_pdu( struct lap_cb *self, __u8 dlsap, __u8 slsap, - __u8 opcode, struct sk_buff *skb); -void irlmp_link_data_indication( struct lap_cb *, int reliable, - struct sk_buff *); -void irlmp_link_connect_indication( struct lap_cb *, struct qos_info *qos, - struct sk_buff *skb); -void irlmp_link_connect_request( __u32 daddr); -void irlmp_link_connect_confirm( struct lap_cb *self, struct qos_info *qos, - struct sk_buff *skb); -void irlmp_link_disconnect_indication( struct lap_cb *self, - struct irlap_cb *irlap, - LAP_REASON reason, - struct sk_buff *); -void irlmp_link_discovery_confirm( struct lap_cb *self, hashbin_t *log); -/* void irlmp_link_disconnect_request( void); */ +inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, + int expedited, struct sk_buff *skb); +void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, + __u8 opcode, struct sk_buff *skb); +void irlmp_link_data_indication(struct lap_cb *, int reliable, + struct sk_buff *); +void irlmp_link_connect_indication(struct lap_cb *, __u32 saddr, __u32 daddr, + struct qos_info *qos, struct sk_buff *skb); +void irlmp_link_connect_request(__u32 daddr); +void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos, + struct sk_buff *skb); +void irlmp_link_disconnect_indication(struct lap_cb *, struct irlap_cb *, + LAP_REASON reason, struct sk_buff *); +void irlmp_link_discovery_confirm(struct lap_cb *self, hashbin_t *log); +void irlmp_link_discovery_indication(struct lap_cb *, discovery_t *discovery); #endif diff --git a/include/net/irda/irlpt_cli.h b/include/net/irda/irlpt_cli.h index 1a54c68eb..ab3178885 100644 --- a/include/net/irda/irlpt_cli.h +++ b/include/net/irda/irlpt_cli.h @@ -1,12 +1,12 @@ /********************************************************************* * - * Filename: irlpt_client.h + * Filename: irlpt_cli.h * Version: 0.1 * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Feb 21 18:54:38 1998 - * Modified at: Mon Jan 11 15:58:16 1999 + * Modified at: Wed Apr 21 16:46:26 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net> @@ -34,9 +34,11 @@ * if it's static, it doesn't go in here. */ -void irlpt_client_get_value_confirm(__u16 obj_id, - struct ias_value *value, void *priv); -void irlpt_client_connect_indication( void *instance, void *sap, +void irlpt_client_get_value_confirm(int result, __u16 obj_id, + struct ias_value *value, + void *priv); +void irlpt_client_connect_indication( void *instance, + void *sap, struct qos_info *qos, int max_seg_size, struct sk_buff *skb); diff --git a/include/net/irda/irlpt_cli_fsm.h b/include/net/irda/irlpt_cli_fsm.h index 4013c2f4d..b6fd153a5 100644 --- a/include/net/irda/irlpt_cli_fsm.h +++ b/include/net/irda/irlpt_cli_fsm.h @@ -1,19 +1,21 @@ /********************************************************************* * - * Filename: irlpt_client_fsm.h + * Filename: irlpt_cli_fsm.h * Version: 0.1 * Sources: irlan_event.h * - * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. - * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, All Rights Reserved. + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, + * All Rights Reserved. + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, + * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * - * I, Thomas Davis, provide no warranty for any of this software. This material is - * provided "AS-IS" and at no charge. + * I, Thomas Davis, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. * ********************************************************************/ diff --git a/include/net/irda/irlpt_common.h b/include/net/irda/irlpt_common.h index 0e51b017a..83a9c307c 100644 --- a/include/net/irda/irlpt_common.h +++ b/include/net/irda/irlpt_common.h @@ -1,6 +1,6 @@ /********************************************************************* * - * Filename: irlpt.c + * Filename: irlpt_common.h * Version: * Description: * Status: Experimental. @@ -67,7 +67,6 @@ typedef enum { IRLPT_CLIENT_QUERY, IRLPT_CLIENT_READY, IRLPT_CLIENT_WAITI, - IRLPT_CLIENT_WAITR, IRLPT_CLIENT_CONN, } IRLPT_CLIENT_STATE; @@ -87,10 +86,6 @@ typedef enum { LMP_DISCONNECT, LMP_CONNECT_INDICATION, LMP_DISCONNECT_INDICATION, -#if 0 - TTP_CONNECT_INDICATION, - TTP_DISCONNECT_INDICATION, -#endif IRLPT_DISCOVERY_INDICATION, IRLPT_CONNECT_REQUEST, IRLPT_DISCONNECT_REQUEST, @@ -101,6 +96,7 @@ struct irlpt_info { struct lsap_cb *lsap; __u8 dlsap_sel; __u32 daddr; + __u32 saddr; }; /* Command packet types */ @@ -142,7 +138,8 @@ struct irlpt_cb { int magic; /* magic used to detect corruption of the struct */ - __u32 daddr; /* my local address. */ + __u32 daddr; /* address of remote printer */ + __u32 saddr; /* my local address. */ struct timer_list retry_timer; @@ -168,6 +165,14 @@ struct irlpt_cb { struct wait_queue *write_wait; struct wait_queue *ex_wait; + /* this is used to remove the printer when it's gone */ + struct timer_list lpt_timer; + void (*timeout) (unsigned long data); + + void (*do_event) (struct irlpt_cb *self, IRLPT_EVENT event, + struct sk_buff *skb, + struct irlpt_info *info); + /* this is used by the server side of the system */ IRLPT_SERVER_STATE connected; diff --git a/include/net/irda/irlpt_server.h b/include/net/irda/irlpt_server.h index 7984a331d..44e310f95 100644 --- a/include/net/irda/irlpt_server.h +++ b/include/net/irda/irlpt_server.h @@ -1,6 +1,6 @@ /********************************************************************* * - * Filename: server.h + * Filename: irlpt_server.h * Version: 0.1 * Description: * Status: Experimental. diff --git a/include/net/irda/irlpt_server_fsm.h b/include/net/irda/irlpt_server_fsm.h index 8f23226c3..c7ee3f871 100644 --- a/include/net/irda/irlpt_server_fsm.h +++ b/include/net/irda/irlpt_server_fsm.h @@ -1,19 +1,21 @@ /********************************************************************* * - * Filename: server_fsm.h<2> + * Filename: server_server_fsm.h * Version: 0.1 * Sources: irlan_event.h * - * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. - * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, All Rights Reserved. + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, + * All Rights Reserved. + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, + * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * - * I, Thomas Davis, provide no warranty for any of this software. This material is - * provided "AS-IS" and at no charge. + * I, Thomas Davis, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. * ********************************************************************/ @@ -23,8 +25,11 @@ #include <linux/kernel.h> #include <linux/skbuff.h> -void irlpt_server_do_event( struct irlpt_cb *self, IRLPT_EVENT event, - struct sk_buff *skb, struct irlpt_info *info); -void irlpt_server_next_state( struct irlpt_cb *self, IRLPT_SERVER_STATE state); +void irlpt_server_do_event( struct irlpt_cb *self, + IRLPT_EVENT event, + struct sk_buff *skb, + struct irlpt_info *info); +void irlpt_server_next_state( struct irlpt_cb *self, + IRLPT_SERVER_STATE state); #endif diff --git a/include/net/irda/irmod.h b/include/net/irda/irmod.h index a2f592572..651e87dbc 100644 --- a/include/net/irda/irmod.h +++ b/include/net/irda/irmod.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Dec 15 13:58:52 1997 - * Modified at: Tue Jan 12 14:56:11 1999 + * Modified at: Fri Apr 9 11:13:39 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli, All Rights Reserved. @@ -29,7 +29,6 @@ #include <linux/miscdevice.h> #include <net/irda/irqueue.h> -#include <net/irda/qos.h> #define IRMGR_IOC_MAGIC 'm' #define IRMGR_IOCTNPC _IO(IRMGR_IOC_MAGIC, 1) @@ -99,167 +98,43 @@ struct irda_cb { QUEUE *todo_queue; /* Todo list */ }; -typedef struct { - char irda_call[7]; /* 6 call + SSID (shifted ascii!) */ -} irda_address; - -struct sockaddr_irda { - short sirda_family; - irda_address sirda_call; - int sirda_ndigis; -}; - -/* - * This type is used by the protocols that transmit 16 bits words in - * little endian format. A little endian machine stores MSB of word in - * byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0] - * and LSB in byte[1]. - */ -typedef union { - __u16 word; - __u8 byte[2]; -} __u16_host_order; +int irmod_init_module(void); +void irmod_cleanup_module(void); /* - * Information monitored by some layers + * Function irda_lock (lock) + * + * Lock variable. Returns false if the lock is already set. + * */ -struct irda_statistics +static inline int irda_lock(int *lock) { - int rx_packets; /* total packets received */ - int tx_packets; /* total packets transmitted */ - int rx_errors; /* bad packets received */ - int tx_errors; /* packet transmit problems */ - int rx_dropped; /* no space in linux buffers */ - int tx_dropped; /* no space available in linux */ - int rx_compressed; - int tx_compressed; - int rx_bytes; /* total bytes received */ - int tx_bytes; /* total bytes transmitted */ + if (test_and_set_bit( 0, (void *) lock)) { + DEBUG(3, __FUNCTION__ + "(), Trying to lock, already locked variable!\n"); + return FALSE; + } + return TRUE; +} - int multicast; /* multicast packets received */ - int collisions; - - /* detailed rx_errors: */ - int rx_length_errors; - int rx_over_errors; /* receiver ring buff overflow */ - int rx_crc_errors; /* recved pkt with crc error */ - int rx_frame_errors; /* recv'd frame alignment error */ - int rx_fifo_errors; /* recv'r fifo overrun */ - int rx_missed_errors; /* receiver missed packet */ +inline int irda_unlock(int *lock); - /* detailed tx_errors */ - int tx_aborted_errors; - int tx_carrier_errors; - int tx_fifo_errors; - int tx_heartbeat_errors; - int tx_window_errors; -}; +void irda_notify_init(struct notify_t *notify); -typedef enum { - NO_CHANGE, - LOCKED, - UNLOCKED, -} LOCK_STATUS; +void irda_execute_as_process(void *self, TODO_CALLBACK callback, __u32 param); +void irmanager_notify(struct irmanager_event *event); -/* Misc status information */ -typedef enum { - STATUS_OK, - STATUS_ABORTED, - STATUS_NO_ACTIVITY, - STATUS_NOISY, - STATUS_REMOTE, -} LINK_STATUS; +extern void irda_proc_modcount(struct inode *, int); +void irda_mod_inc_use_count(void); +void irda_mod_dec_use_count(void); -typedef enum { /* FIXME check the two first reason codes */ - LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */ - LAP_NO_RESPONSE, /* To many retransmits without response */ - LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */ - LAP_FOUND_NONE, /* No devices were discovered */ - LAP_MEDIA_BUSY, - LAP_PRIMARY_CONFLICT, -} LAP_REASON; +#endif /* IRMOD_H */ -/* - * IrLMP disconnect reasons. The order is very important, since they - * correspond to disconnect reasons sent in IrLMP disconnect frames, so - * please do not touch :-) - */ -typedef enum { - LM_USER_REQUEST = 1, /* User request */ - LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */ - LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */ - LM_LAP_RESET, /* IrLAP reset */ - LM_INIT_DISCONNECT, /* Link Management initiated disconnect */ -} LM_REASON; /* FIXME: Just for now */ -/* - * IrLMP character code values - */ -#define CS_ASCII 0x00 -#define CS_ISO_8859_1 0x01 -#define CS_ISO_8859_2 0x02 -#define CS_ISO_8859_3 0x03 -#define CS_ISO_8859_4 0x04 -#define CS_ISO_8859_5 0x05 -#define CS_ISO_8859_6 0x06 -#define CS_ISO_8859_7 0x07 -#define CS_ISO_8859_8 0x08 -#define CS_ISO_8859_9 0x09 -#define CS_UNICODE 0xff - -/* - * The DISCOVERY structure is used for both discovery requests and responses - */ -#define DISCOVERY struct discovery_t -struct discovery_t { - QUEUE queue; /* Must be first! */ - - __u32 saddr; /* Which link the device was discovered */ - __u32 daddr; /* Remote device address */ - LAP_REASON condition; /* More info about the discovery */ - - __u8 hint[2]; /* Discovery hint bits */ - __u8 charset; - char info[32]; /* Usually the name of the device */ - __u8 info_len; /* Length of device info field */ - - int gen_addr_bit; /* Need to generate a new device address? */ -}; -typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW; -/* - * Notify structure used between transport and link management layers - */ -struct notify_t { - void (*data_indication)( void *instance, void *sap, - struct sk_buff *skb); - void (*udata_indication)( void *instance, void *sap, - struct sk_buff *skb); - void (*connect_confirm)( void *instance, void *sap, - struct qos_info *qos, int max_sdu_size, - struct sk_buff *skb); - void (*connect_indication)( void *instance, void *sap, - struct qos_info *qos, int max_sdu_size, - struct sk_buff *skb); - void (*disconnect_indication)( void *instance, void *sap, - LM_REASON reason, struct sk_buff *); - void (*flow_indication)( void *instance, void *sap, LOCAL_FLOW flow); - void *instance; /* Layer instance pointer */ - char name[16]; /* Name of layer */ -}; -#define NOTIFY_MAX_NAME 16 - -int irmod_init_module(void); -void irmod_cleanup_module(void); -inline int irda_lock( int *lock); -inline int irda_unlock( int *lock); -void irda_notify_init( struct notify_t *notify); -void irda_execute_as_process( void *self, TODO_CALLBACK callback, __u32 param); -void irmanager_notify( struct irmanager_event *event); -#endif diff --git a/include/net/irda/irobex.h b/include/net/irda/irobex.h deleted file mode 100644 index 8f69707d0..000000000 --- a/include/net/irda/irobex.h +++ /dev/null @@ -1,135 +0,0 @@ -/********************************************************************* - * - * Filename: irobex.h - * Version: - * Description: - * Status: Experimental. - * Author: Dag Brattli <dagb@cs.uit.no> - * Created at: Sat Jul 4 22:43:57 1998 - * Modified at: Wed Jan 13 15:55:28 1999 - * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998 Dag Brattli, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is - * provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IROBEX_H -#define IROBEX_H - -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/skbuff.h> -/* #include <linux/netdevice.h> */ -#include <linux/miscdevice.h> - -#include <net/irda/timer.h> -#include <net/irda/qos.h> -#include <net/irda/irmod.h> - -#define LOW_THRESHOLD 4 -#define HIGH_THRESHOLD 8 -#define IROBEX_MAX_QUEUE 12 - -/* Small structure to be used by the IOCTL call */ -struct irobex_ioc_t { - __u32 daddr; -}; - -#define IROBEX_IOC_MAGIC 'k' - -#define IROBEX_IOCSCONNECT _IOW(IROBEX_IOC_MAGIC, 1, 4) -#define IROBEX_IOCSDISCONNECT _IOW(IROBEX_IOC_MAGIC, 2, 4) -#define IROBEX_IOC_MAXNR 2 - -#define IROBEX_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER) - -typedef enum { - OBEX_IDLE, /* Doing nothing */ - OBEX_DISCOVER, /* Trying to discovery remote device */ - OBEX_QUERY, /* Querying remote LM-IAS */ - OBEX_CONN, /* Trying to connect to remote device */ - OBEX_DATA, /* Data transfer ready */ -} OBEX_STATE; - -struct irobex_cb { - QUEUE queue; /* Must be first! */ - - int magic; /* magic used to detect corruption of the struct */ - - OBEX_STATE state; /* Current state */ - - __u32 saddr; /* my local address */ - __u32 daddr; /* peer address */ - unsigned long time_discovered; - - char devname[9]; /* name of the registered device */ - struct tsap_cb *tsap; - int eof; - - __u8 dtsap_sel; /* remote TSAP address */ - __u8 stsap_sel; /* local TSAP address */ - - int irlap_data_size; - - struct miscdevice dev; - - int count; /* open count */ - - struct sk_buff_head rx_queue; /* Receive queue */ - - struct wait_queue *read_wait; - struct wait_queue *write_wait; - - struct fasync_struct *async; - - struct timer_list watchdog_timer; - - LOCAL_FLOW tx_flow; - LOCAL_FLOW rx_flow; -}; - -int irobex_init(void); -void irobex_cleanup(void); -struct irobex_cb *irobex_open(void); -void irobex_close( struct irobex_cb *self); - -void irobex_discovery_indication( DISCOVERY *); - -void irobex_data_request( int handle, struct sk_buff *skb); -void irobex_data_indication( void *instance, void *sap, struct sk_buff *skb); -void irobex_control_data_indication( void *instance, void *sap, - struct sk_buff *skb); - -void irobex_connect_request( struct irobex_cb *self); -void irobex_connect(struct irobex_cb *self, struct sk_buff *skb); -void irobex_connect_confirm( void *instance, void *sap, struct qos_info *qos, - int max_sdu_size, struct sk_buff *skb); -void irobex_disconnect_indication( void *instance, void *sap, LM_REASON reason, - struct sk_buff *skb); -void irobex_flow_indication( void *instance, void *sap, LOCAL_FLOW flow); - -void irobex_extract_params( struct sk_buff *skb); -void irobex_get_value_confirm(__u16 obj_id, struct ias_value *value, - void *priv); -void irobex_register_server( struct irobex_cb *self); - -void irobex_watchdog_timer_expired( unsigned long data); - -inline void irobex_start_watchdog_timer( struct irobex_cb *self, int timeout) -{ - irda_start_timer( &self->watchdog_timer, timeout, (unsigned long) self, - irobex_watchdog_timer_expired); -} - -extern struct irobex_cb *irobex; - -#endif diff --git a/include/net/irda/irqueue.h b/include/net/irda/irqueue.h index 0551e3b52..1e208ccf4 100644 --- a/include/net/irda/irqueue.h +++ b/include/net/irda/irqueue.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Jun 9 13:26:50 1998 - * Modified at: Sun Oct 25 00:26:31 1998 + * Modified at: Thu Feb 25 20:34:21 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (C) 1998, Aage Kvalnes <aage@cs.uit.no> @@ -30,7 +30,7 @@ #include <linux/types.h> #include <asm/spinlock.h> -#include <net/irda/irda.h> +/* #include <net/irda/irda.h> */ #ifndef QUEUE_H #define QUEUE_H @@ -51,6 +51,10 @@ #define HASHBIN_SIZE 8 #define HASHBIN_MASK 0x7 +#ifndef ALIGN +#define ALIGN __attribute__((aligned)) +#endif + typedef void (*FREE_FUNC)( void *arg); /* diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h index 02a486dd5..aec1d57dc 100644 --- a/include/net/irda/irttp.h +++ b/include/net/irda/irttp.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: irttp.h - * Version: 0.3 + * Version: 1.0 * Description: Tiny Transport Protocol (TTP) definitions * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:31 1997 - * Modified at: Sat Dec 5 13:48:12 1998 + * Modified at: Sat Apr 10 10:19:56 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -27,42 +27,44 @@ #include <linux/types.h> #include <linux/skbuff.h> +#include <asm/spinlock.h> -#include <net/irda/irmod.h> +#include <net/irda/irda.h> #include <net/irda/irlmp.h> #include <net/irda/qos.h> #include <net/irda/irqueue.h> -#define TTP_MAX_CONNECTIONS LM_MAX_CONNECTIONS -#define TTP_HEADER 1 -#define TTP_HEADER_WITH_SAR 6 -#define TTP_PARAMETERS 0x80 -#define TTP_MORE 0x80 +#define TTP_MAX_CONNECTIONS LM_MAX_CONNECTIONS +#define TTP_HEADER 1 +#define TTP_HEADER_WITH_SAR 6 +#define TTP_PARAMETERS 0x80 +#define TTP_MORE 0x80 #define DEFAULT_INITIAL_CREDIT 22 -#define LOW_THRESHOLD 4 -#define HIGH_THRESHOLD 8 -#define TTP_MAX_QUEUE 22 +#define LOW_THRESHOLD 4 +#define HIGH_THRESHOLD 8 +#define TTP_MAX_QUEUE 22 /* Some priorities for disconnect requests */ -#define P_NORMAL 0 -#define P_HIGH 1 +#define P_NORMAL 0 +#define P_HIGH 1 #define SAR_DISABLE 0 +#define SAR_UNBOUND 0xffffffff /* * This structure contains all data assosiated with one instance of a TTP * connection. */ struct tsap_cb { - QUEUE queue; /* For linking it into the hashbin */ - int magic; /* Just in case */ + QUEUE queue; /* For linking it into the hashbin */ + int magic; /* Just in case */ - int max_seg_size; /* Max data that fit into an IrLAP frame */ + int max_seg_size; /* Max data that fit into an IrLAP frame */ - __u8 stsap_sel; /* Source TSAP */ - __u8 dtsap_sel; /* Destination TSAP */ + __u8 stsap_sel; /* Source TSAP */ + __u8 dtsap_sel; /* Destination TSAP */ struct lsap_cb *lsap; /* Corresponding LSAP to this TSAP */ @@ -79,21 +81,21 @@ struct tsap_cb { struct sk_buff_head rx_fragments; int tx_queue_lock; int rx_queue_lock; + spinlock_t lock; struct notify_t notify; /* Callbacks to client layer */ struct irda_statistics stats; struct timer_list todo_timer; - int rx_sdu_busy; /* RxSdu.busy */ - int rx_sdu_size; /* The current size of a partially received frame */ - int rx_max_sdu_size; /* Max receive user data size */ + int rx_sdu_busy; /* RxSdu.busy */ + __u32 rx_sdu_size; /* Current size of a partially received frame */ + __u32 rx_max_sdu_size; /* Max receive user data size */ - int tx_sdu_busy; /* TxSdu.busy */ - int tx_max_sdu_size; /* Max transmit user data size */ - - int no_defrag; /* Don't reassemble received fragments */ + int tx_sdu_busy; /* TxSdu.busy */ + __u32 tx_max_sdu_size; /* Max transmit user data size */ + int close_pend; /* Close, but disconnect_pend */ int disconnect_pend; /* Disconnect, but still data to send */ struct sk_buff *disconnect_skb; }; @@ -107,28 +109,34 @@ struct irttp_cb { int irttp_init(void); void irttp_cleanup(void); -struct tsap_cb *irttp_open_tsap( __u8 stsap, int credit, - struct notify_t *notify); -void irttp_close_tsap( struct tsap_cb *self); +struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, + struct notify_t *notify); +int irttp_close_tsap(struct tsap_cb *self); -int irttp_data_request( struct tsap_cb *self, struct sk_buff *skb); -int irttp_udata_request( struct tsap_cb *self, struct sk_buff *skb); +int irttp_data_request(struct tsap_cb *self, struct sk_buff *skb); +int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb); -void irttp_connect_request( struct tsap_cb *self, __u8 dtsap_sel, __u32 daddr, - struct qos_info *qos, int max_sdu_size, +int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel, + __u32 saddr, __u32 daddr, + struct qos_info *qos, __u32 max_sdu_size, + struct sk_buff *userdata); +void irttp_connect_confirm(void *instance, void *sap, struct qos_info *qos, + __u32 max_sdu_size, struct sk_buff *skb); +void irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size, struct sk_buff *userdata); -void irttp_connect_confirm( void *instance, void *sap, struct qos_info *qos, - int max_sdu_size, struct sk_buff *skb); -void irttp_connect_response( struct tsap_cb *self, int max_sdu_size, - struct sk_buff *userdata); +struct tsap_cb *irttp_dup(struct tsap_cb *self, void *instance); +void irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *skb, + int priority); +void irttp_flow_request(struct tsap_cb *self, LOCAL_FLOW flow); -void irttp_disconnect_request( struct tsap_cb *self, struct sk_buff *skb, - int priority); -void irttp_flow_request( struct tsap_cb *self, LOCAL_FLOW flow); +static __inline __u32 irttp_get_saddr(struct tsap_cb *self) +{ + return irlmp_get_saddr(self->lsap); +} -static __inline__ void irttp_no_reassemble( struct tsap_cb *self) +static __inline __u32 irttp_get_daddr(struct tsap_cb *self) { - self->no_defrag = TRUE; + return irlmp_get_daddr(self->lsap); } extern struct irttp_cb *irttp; diff --git a/include/net/irda/irtty.h b/include/net/irda/irtty.h index 313a32d9b..920909600 100644 --- a/include/net/irda/irtty.h +++ b/include/net/irda/irtty.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: irtty.h - * Version: 0.1 + * Version: 1.0 * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Dec 9 21:13:12 1997 - * Modified at: Mon Dec 14 11:22:37 1998 + * Modified at: Sun Feb 7 01:57:33 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997 Dag Brattli, All Rights Reserved. @@ -65,4 +65,6 @@ struct irtty_cb { int irtty_register_dongle( struct dongle *dongle); void irtty_unregister_dongle( struct dongle *dongle); +void irtty_set_dtr_rts(struct tty_struct *tty, int dtr, int rts); + #endif diff --git a/include/net/irda/irvtd.h b/include/net/irda/irvtd.h index 43d61c9c0..1fc7d6b0f 100644 --- a/include/net/irda/irvtd.h +++ b/include/net/irda/irvtd.h @@ -17,12 +17,13 @@ * ********************************************************************/ -#ifndef IRCOMM_H -#define IRCOMM_H +#ifndef IRVTD_H +#define IRVTD_H #include <linux/types.h> #include <linux/ioctl.h> #include <linux/tqueue.h> +#include <linux/serial.h> #include <net/irda/irmod.h> #include <net/irda/qos.h> @@ -34,18 +35,11 @@ #define IRVTD_RX_QUEUE_HIGH 10 #define IRVTD_RX_QUEUE_LOW 2 +#define IRCOMM_MAJOR 60; /* Zero means automatic allocation + 60,61,62,and 63 is reserved for experiment */ +#define IRVTD_MINOR 64 + -/* - * Serial input interrupt line counters -- external structure - * Four lines can interrupt: CTS, DSR, RI, DCD - * - * this structure must be compatible with serial_icounter_struct defined in - * <linux/serial.h>. - */ -struct icounter_struct { - int cts, dsr, rng, dcd; - int reserved[16]; -}; struct irvtd_cb { @@ -53,9 +47,10 @@ struct irvtd_cb { /* if daddr is NULL, remote device have not been discovered yet */ + int tx_disable; int rx_disable; - struct sk_buff *txbuff; /* buffer queue */ - struct sk_buff_head rxbuff; /* buffer queue */ + struct sk_buff *txbuff; + struct sk_buff_head rxbuff; struct ircomm_cb *comm; /* ircomm instance */ /* @@ -63,7 +58,6 @@ struct irvtd_cb { * See linux/serial.h */ - int baud_base; int flags; struct tty_struct *tty; @@ -75,30 +69,24 @@ struct irvtd_cb { struct wait_queue *delta_msr_wait; struct wait_queue *tx_wait; - struct tq_struct rx_tqueue; + struct timer_list timer; long pgrp; long session; - struct termios normal_termios; - struct termios callout_termios; unsigned short closing_wait; /* time to wait before closing */ unsigned short close_delay; + int custom_divisor; int mcr; int msr; int cts_stoptx; int ttp_stoptx; int ttp_stoprx; - struct icounter_struct icount; + int disconnect_pend; + struct serial_icounter_struct icount; int read_status_mask; int ignore_status_mask; }; -/* Debug function */ - -/* #define CHECK_SKB(skb) check_skb((skb), __LINE__,__FILE__) */ - - - #endif diff --git a/include/net/irda/irvtd_driver.h b/include/net/irda/irvtd_driver.h deleted file mode 100644 index 4983b3d2c..000000000 --- a/include/net/irda/irvtd_driver.h +++ /dev/null @@ -1,122 +0,0 @@ -/********************************************************************* - * - * Filename: irvtd_driver.h - * Version: 0.1 - * - * Copyright (c) 1998, Takahide Higuchi <thiguchi@pluto.dti.ne.jp>, - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * I, Takahide Higuchi, provide no warranty for any of this software. - * This material is provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#include <linux/tty.h> - -#include <net/irda/irlap.h> -#include <net/irda/irlmp.h> -#include <net/irda/irttp.h> - - -#define VSP_TYPE_NORMAL 1 -#define VSP_TYPE_CALLOUT 2 -#define IRCOMM_MAJOR 60; /* Zero means automatic allocation - 60,61,62,and 63 is reserved for experiment */ -#define IRVTD_MINOR 64 -#define IRVTD_CALLOUT_MINOR 32 - -#define IRVTD_TYPE_NORMAL 11 -#define IRVTD_TYPE_CALLOUT 12 - - -#define IRCOMM_HEADER 1 -#define IRCOMM_RESERVE LAP_HEADER+LMP_HEADER+TTP_HEADER+IRCOMM_HEADER - - - - - -/* - * Definitions for ircomm_cb_struct flags field - * this section is "stolen" from linux-kernel (drivers/char/serial.c) - */ -#define IRVTD_ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes - on the callout port */ -/* #define IRVTD_ASYNC_FOURPORT 0x0002 */ -/* Set OU1, OUT2 per AST Fourport settings */ - -#define IRVTD_ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ - -#define IRVTD_ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ - -#define IRVTD_ASYNC_SPD_MASK 0x0030 -#define IRVTD_ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ - -#define IRVTD_ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ -#define IRVTD_ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ - -#define IRVTD_ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ -#define IRVTD_ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ -#define IRVTD_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ -#define IRVTD_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ -#define IRVTD_ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ - -#define IRVTD_ASYNC_FLAGS 0x0FFF /* Possible legal async flags */ -#define IRVTD_ASYNC_USR_MASK 0x0430 /* Legal flags that non-privileged - * users can set or reset */ - -/* Internal flags used only by kernel/chr_drv/serial.c */ -#define IRVTD_ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */ -#define IRVTD_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */ -#define IRVTD_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ -#define IRVTD_ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ -#define IRVTD_ASYNC_CLOSING 0x08000000 /* Serial port is closing */ -#define IRVTD_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ -#define IRVTD_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ -#define IRVTD_ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards */ - - -#define IRVTD_ASYNC_CLOSING_WAIT_INF 0 -#define IRVTD_ASYNC_CLOSING_WAIT_NONE 65535 - -/**************************************/ - -#define DELTA_DTR 0x01 -#define DELTA_RTS 0x02 -#define MCR_DTR 0x04 -#define MCR_RTS 0x08 - -#define DELTA_CTS 0x01 -#define DELTA_DSR 0x02 -#define DELTA_RI 0x04 -#define DELTA_DCD 0x08 -#define MSR_CTS 0x10 -#define MSR_DSR 0x20 -#define MSR_RI 0x40 -#define MSR_DCD 0x80 - -#define LSR_OE 0x02 /* Overrun error indicator */ -#define LSR_PE 0x04 /* Parity error indicator */ -#define LSR_FE 0x08 /* Frame error indicator */ -#define LSR_BI 0x01 /* Break interrupt indicator */ - - - -/**************************************/ - - - - -int irvtd_register_ttydriver(void); -void irvtd_unregister_ttydriver(void); - -void irvtd_flush_chars(struct tty_struct *tty); - - - - diff --git a/include/net/irda/pc87108.h b/include/net/irda/pc87108.h index ed47bdc1b..8be4feea1 100644 --- a/include/net/irda/pc87108.h +++ b/include/net/irda/pc87108.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Fri Nov 13 14:37:40 1998 - * Modified at: Thu Dec 10 19:58:20 1998 + * Modified at: Mon Jan 25 23:10:25 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no> @@ -148,8 +148,8 @@ #define FRM_ST_MAX_LEN 0x10 /* Max frame len exceeded */ #define FRM_ST_PHY_ERR 0x08 /* Physical layer error */ #define FRM_ST_BAD_CRC 0x04 -#define FRM_ST_OVR2 0x02 /* Receive overrun */ -#define FRM_ST_OVR1 0x01 /* Frame status FIFO overrun */ +#define FRM_ST_OVR1 0x02 /* Receive overrun */ +#define FRM_ST_OVR2 0x01 /* Frame status FIFO overrun */ #define RFLFL 0x06 #define RFLFH 0x07 diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h index 35a5be260..6c194a3d4 100644 --- a/include/net/irda/timer.h +++ b/include/net/irda/timer.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Aug 16 00:59:29 1997 - * Modified at: Mon Nov 2 14:31:55 1998 + * Modified at: Tue Apr 6 16:17:16 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997, 1998 Dag Brattli <dagb@cs.uit.no>, @@ -26,54 +26,57 @@ #ifndef TIMER_H #define TIMER_H -#include "irda.h" -#include "irmod.h" -#include "irlap.h" -#include "irlmp.h" -#include "irda_device.h" +#include <asm/param.h> /* for HZ */ + +#include <net/irda/irda.h> +#include <net/irda/irmod.h> +#include <net/irda/irlap.h> +#include <net/irda/irlmp.h> +#include <net/irda/irda_device.h> /* * Timeout definitions, some defined in IrLAP p. 92 */ -#define POLL_TIMEOUT 45 /* Must never exceed 500 ms */ -#define FINAL_TIMEOUT 50 /* Must never exceed 500 ms */ +#define POLL_TIMEOUT 450*HZ/1000 /* Must never exceed 500 ms */ +#define FINAL_TIMEOUT 500*HZ/1000 /* Must never exceed 500 ms */ /* * Normally twice of p-timer. Note 3, IrLAP p. 60 suggests at least twice * duration of the P-timer. */ #define WD_TIMEOUT POLL_TIMEOUT*2 -#define MEDIABUSY_TIMEOUT 50 /* 500 msec */ +#define MEDIABUSY_TIMEOUT 500*HZ/1000 /* 500 msec */ /* * Slot timer must never exceed 85 ms, and must always be at least 25 ms, * suggested to 75-85 msec by IrDA lite */ -#define SLOT_TIMEOUT 8 -#define QUERY_TIMEOUT 100 +#define SLOT_TIMEOUT 80*HZ/1000 +#define QUERY_TIMEOUT HZ /* 1 sec */ -#define WATCHDOG_TIMEOUT 2000 /* 20 sec */ -#define RETRY_TIMEOUT 51 +#define WATCHDOG_TIMEOUT 20*HZ /* 20 sec */ -typedef void (*TIMER_CALLBACK)( unsigned long); +typedef void (*TIMER_CALLBACK)(unsigned long); -void irda_start_timer( struct timer_list *ptimer, int timeout, int data, - TIMER_CALLBACK callback); +void irda_start_timer(struct timer_list *ptimer, int timeout, int data, + TIMER_CALLBACK callback); -inline void irlap_start_slot_timer( struct irlap_cb *self, int timeout); -inline void irlap_start_query_timer( struct irlap_cb *self, int timeout); -inline void irlap_start_final_timer( struct irlap_cb *self, int timeout); -inline void irlap_start_wd_timer( struct irlap_cb *self, int timeout); -inline void irlap_start_backoff_timer( struct irlap_cb *self, int timeout); +inline void irlap_start_slot_timer(struct irlap_cb *self, int timeout); +inline void irlap_start_query_timer(struct irlap_cb *self, int timeout); +inline void irlap_start_final_timer(struct irlap_cb *self, int timeout); +inline void irlap_start_wd_timer(struct irlap_cb *self, int timeout); +inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout); -inline void irda_device_start_mbusy_timer( struct irda_device *self); +inline void irda_device_start_mbusy_timer(struct irda_device *self); struct lsap_cb; -inline void irlmp_start_watchdog_timer( struct lsap_cb *, int timeout); -inline void irlmp_start_discovery_timer( struct irlmp_cb *, int timeout); +struct lap_cb; +inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout); +inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout); +inline void irlmp_start_idle_timer(struct lap_cb *, int timeout); struct irobex_cb; -inline void irobex_start_watchdog_timer( struct irobex_cb *, int timeout); +inline void irobex_start_watchdog_timer(struct irobex_cb *, int timeout); #endif diff --git a/include/net/irda/uircc.h b/include/net/irda/uircc.h index a8b4c02dd..adab0c74f 100644 --- a/include/net/irda/uircc.h +++ b/include/net/irda/uircc.h @@ -7,7 +7,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Dec 26 11:00:49 1998 - * Modified at: Tue Jan 19 23:52:46 1999 + * Modified at: Thu Mar 11 01:37:20 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli, All Rights Reserved. @@ -77,6 +77,7 @@ #define UIRCC_CR12 0x0c /* Timer counter initial value (low byte) */ #define UIRCC_CR13 0x0d /* Timer counter initial value (high byte) */ +#define UIRCC_CR15 0x0f /* Status registers (read only) */ #define UIRCC_SR0 0x00 /* Transmit/receive status register */ @@ -102,9 +103,10 @@ #define UIRCC_SR9 0x09 /* System status 1 */ #define UIRCC_SR10 0x0a /* Modem select status */ - +#define UIRCC_SR11 0x0b #define UIRCC_SR12 0x0c /* Timer counter status (low byte) */ #define UIRCC_SR13 0x0d /* Timer counter status (high byte) */ +#define UIRCC_SR15 0x0f /* Private data for each instance */ struct uircc_cb { diff --git a/include/net/irda/wrapper.h b/include/net/irda/wrapper.h index 838713f31..ca21ebec5 100644 --- a/include/net/irda/wrapper.h +++ b/include/net/irda/wrapper.h @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: wrapper.h - * Version: + * Version: 1.0 * Description: IrDA Wrapper layer * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Thu Nov 19 13:17:56 1998 + * Modified at: Fri Jan 29 10:15:46 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -28,7 +28,7 @@ #include <linux/types.h> #include <linux/skbuff.h> -#include "irda_device.h" +#include <net/irda/irda_device.h> #define BOF 0xc0 /* Beginning of frame */ #define XBOF 0xff @@ -40,9 +40,6 @@ #define IR_TRANS 0x20 /* Asynchronous transparency modifier */ -#define SOP BOF /* Start of */ -#define EOP EOF /* End of */ - enum { OUTSIDE_FRAME = 1, BEGIN_FRAME, diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 76dd6f4fd..5c5d90bb0 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -226,7 +226,6 @@ extern __inline__ void neigh_confirm(struct neighbour *neigh) neigh->confirmed = jiffies; } - extern __inline__ struct neighbour * neigh_lookup(struct neigh_table *tbl, const void *pkey, struct device *dev) { @@ -258,6 +257,7 @@ extern __inline__ int neigh_event_send(struct neighbour *neigh, struct sk_buff * extern __inline__ void neigh_table_lock(struct neigh_table *tbl) { atomic_inc(&tbl->lock); + synchronize_bh(); } extern __inline__ void neigh_table_unlock(struct neigh_table *tbl) diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 0d3c25e25..4c37d11ed 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -50,7 +50,7 @@ struct tcf_proto_ops unsigned long (*get)(struct tcf_proto*, u32 handle); void (*put)(struct tcf_proto*, unsigned long); - int (*change)(struct tcf_proto*, u32 handle, struct rtattr **, unsigned long *); + int (*change)(struct tcf_proto*, unsigned long, u32 handle, struct rtattr **, unsigned long *); int (*delete)(struct tcf_proto*, unsigned long); void (*walk)(struct tcf_proto*, struct tcf_walker *arg); @@ -77,6 +77,13 @@ extern __inline__ int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, str return -1; } +extern __inline__ unsigned long cls_set_class(unsigned long *clp, unsigned long cl) +{ + cl = xchg(clp, cl); + synchronize_bh(); + return cl; +} + extern int register_tcf_proto_ops(struct tcf_proto_ops *ops); extern int unregister_tcf_proto_ops(struct tcf_proto_ops *ops); diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 142f7b3c7..9911464fc 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -5,7 +5,7 @@ #define PSCHED_JIFFIES 2 #define PSCHED_CPU 3 -#define PSCHED_CLOCK_SOURCE PSCHED_GETTIMEOFDAY +#define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES #include <linux/pkt_sched.h> #include <net/pkt_cls.h> @@ -25,6 +25,7 @@ struct Qdisc_class_ops { /* Child qdisc manipulation */ int (*graft)(struct Qdisc *, unsigned long cl, struct Qdisc *, struct Qdisc **); + struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); /* Class manipulation routines */ unsigned long (*get)(struct Qdisc *, u32 classid); @@ -35,7 +36,7 @@ struct Qdisc_class_ops /* Filter manipulation */ struct tcf_proto ** (*tcf_chain)(struct Qdisc *, unsigned long); - unsigned long (*bind_tcf)(struct Qdisc *, u32 classid); + unsigned long (*bind_tcf)(struct Qdisc *, unsigned long, u32 classid); void (*unbind_tcf)(struct Qdisc *, unsigned long); /* rtnetlink specific */ @@ -57,6 +58,7 @@ struct Qdisc_ops int (*init)(struct Qdisc *, struct rtattr *arg); void (*reset)(struct Qdisc *); void (*destroy)(struct Qdisc *); + int (*change)(struct Qdisc *, struct rtattr *arg); int (*dump)(struct Qdisc *, struct sk_buff *); }; @@ -74,13 +76,12 @@ struct Qdisc int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); struct sk_buff * (*dequeue)(struct Qdisc *dev); unsigned flags; -#define TCQ_F_DEFAULT 1 -#define TCQ_F_BUILTIN 2 +#define TCQ_F_BUILTIN 1 +#define TCQ_F_THROTTLED 2 struct Qdisc_ops *ops; struct Qdisc *next; u32 handle; - u32 classid; - struct Qdisc *parent; + atomic_t refcnt; struct sk_buff_head q; struct device *dev; @@ -89,6 +90,11 @@ struct Qdisc unsigned long tx_last; int (*reshape_fail)(struct sk_buff *skb, struct Qdisc *q); + /* This field is deprecated, but it is still used by CBQ + * and it will live until better solution will be invented. + */ + struct Qdisc *__parent; + char data[0]; }; @@ -129,6 +135,15 @@ struct qdisc_rate_table which have fast and precise clock source, but it is too expensive. */ +/* General note about internal clock. + + Any clock source returns time intervals, measured in units + close to 1usec. With source PSCHED_GETTIMEOFDAY it is precisely + microseconds, otherwise something close but different chosen to minimize + arithmetic cost. Ratio usec/internal untis in form nominator/denominator + may be read from /proc/net/psched. + */ + #if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY @@ -138,8 +153,12 @@ typedef long psched_tdiff_t; #define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp)) #define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ)) +#define PSCHED_EXPORTLIST EXPORT_SYMBOL(psched_tod_diff); + #else /* PSCHED_CLOCK_SOURCE != PSCHED_GETTIMEOFDAY */ +#define PSCHED_EXPORTLIST PSCHED_EXPORTLIST_1 PSCHED_EXPORTLIST_2 + typedef u64 psched_time_t; typedef long psched_tdiff_t; @@ -147,10 +166,6 @@ extern psched_time_t psched_time_base; #if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES -#define PSCHED_WATCHER unsigned long - -extern PSCHED_WATCHER psched_time_mark; - #if HZ == 100 #define PSCHED_JSCALE 13 #elif HZ == 1024 @@ -159,24 +174,49 @@ extern PSCHED_WATCHER psched_time_mark; #define PSCHED_JSCALE 0 #endif +#define PSCHED_EXPORTLIST_2 + +#if ~0UL == 0xFFFFFFFF + +#define PSCHED_WATCHER unsigned long + +extern PSCHED_WATCHER psched_time_mark; + #define PSCHED_GET_TIME(stamp) ((stamp) = psched_time_base + (((unsigned long)(jiffies-psched_time_mark))<<PSCHED_JSCALE)) -#define PSCHED_US2JIFFIE(delay) ((delay)>>PSCHED_JSCALE) + +#define PSCHED_EXPORTLIST_1 EXPORT_SYMBOL(psched_time_base); \ + EXPORT_SYMBOL(psched_time_mark); + +#else + +#define PSCHED_GET_TIME(stamp) ((stamp) = (jiffies<<PSCHED_JSCALE)) + +#define PSCHED_EXPORTLIST_1 + +#endif + +#define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE) #elif PSCHED_CLOCK_SOURCE == PSCHED_CPU extern psched_tdiff_t psched_clock_per_hz; extern int psched_clock_scale; +#define PSCHED_EXPORTLIST_2 EXPORT_SYMBOL(psched_clock_per_hz); \ + EXPORT_SYMBOL(psched_clock_scale); + #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) #if CPU == 586 || CPU == 686 #define PSCHED_GET_TIME(stamp) \ -({ u32 hi, lo; \ - __asm__ __volatile__ (".byte 0x0f,0x31" :"=a" (lo), "=d" (hi)); \ - (stamp) = ((((u64)hi)<<32) + lo)>>psched_clock_scale; \ +({ u64 __cur; \ + __asm__ __volatile__ (".byte 0x0f,0x31" :"=A" (__cur)); \ + (stamp) = __cur>>psched_clock_scale; \ }) +#define PSCHED_EXPORTLIST_1 + #elif defined (__alpha__) #define PSCHED_WATCHER u32 @@ -191,6 +231,9 @@ extern PSCHED_WATCHER psched_time_mark; (stamp) = (psched_time_base + __res)>>psched_clock_scale; \ }) +#define PSCHED_EXPORTLIST_1 EXPORT_SYMBOL(psched_time_base); \ + EXPORT_SYMBOL(psched_time_mark); + #else #error PSCHED_CLOCK_SOURCE=PSCHED_CPU is not supported on this arch. @@ -219,13 +262,15 @@ extern PSCHED_WATCHER psched_time_mark; __delta; \ }) +extern int psched_tod_diff(int delta_sec, int bound); + #define PSCHED_TDIFF_SAFE(tv1, tv2, bound, guard) \ ({ \ int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ int __delta = (tv1).tv_usec - (tv2).tv_usec; \ switch (__delta_sec) { \ default: \ - __delta = (bound); guard; break; \ + __delta = psched_tod_diff(__delta_sec, bound); guard; break; \ case 2: \ __delta += 1000000; \ case 1: \ @@ -290,6 +335,8 @@ struct tcf_police u32 index; int action; + int result; + u32 ewma_rate; u32 burst; u32 mtu; @@ -298,10 +345,12 @@ struct tcf_police psched_time_t t_c; struct qdisc_rate_table *R_tab; struct qdisc_rate_table *P_tab; + + struct tc_stats stats; }; extern void tcf_police_destroy(struct tcf_police *p); -extern struct tcf_police * tcf_police_locate(struct rtattr *rta); +extern struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est); extern int tcf_police_dump(struct sk_buff *skb, struct tcf_police *p); extern int tcf_police(struct sk_buff *skb, struct tcf_police *p); @@ -327,7 +376,6 @@ void dev_deactivate(struct device *dev); void qdisc_reset(struct Qdisc *qdisc); void qdisc_destroy(struct Qdisc *qdisc); struct Qdisc * qdisc_create_dflt(struct device *dev, struct Qdisc_ops *ops); -struct Qdisc * dev_set_scheduler(struct device *dev, struct Qdisc *qdisc); int qdisc_new_estimator(struct tc_stats *stats, struct rtattr *opt); void qdisc_kill_estimator(struct tc_stats *stats); struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct rtattr *tab); diff --git a/include/net/route.h b/include/net/route.h index bd76d033b..66df47122 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -57,6 +57,9 @@ struct rt_key __u32 src; int iif; int oif; +#ifdef CONFIG_IP_ROUTE_FWMARK + __u32 fwmark; +#endif __u8 tos; __u8 scope; }; @@ -93,6 +96,16 @@ struct rtable extern struct rtable *rt_hash_table[RT_HASH_DIVISOR]; +struct ip_rt_acct +{ + __u32 o_bytes; + __u32 o_packets; + __u32 i_bytes; + __u32 i_packets; +}; + +extern struct ip_rt_acct ip_rt_acct[256]; + extern void ip_rt_init(void); extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, u32 src, u8 tos, struct device *dev); @@ -101,6 +114,7 @@ extern void rt_cache_flush(int how); extern int ip_route_output(struct rtable **, u32 dst, u32 src, u32 tos, int oif); extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct device *devin); extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); +extern void ip_rt_update_pmtu(struct dst_entry *dst, unsigned mtu); extern void ip_rt_send_redirect(struct sk_buff *skb); extern unsigned inet_addr_type(u32 addr); diff --git a/include/net/sock.h b/include/net/sock.h index c03168f4b..e11c1be22 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -81,6 +81,10 @@ #include <net/dn.h> #endif +#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE) +#include <net/irda/irda.h> +#endif + #ifdef CONFIG_FILTER #include <linux/filter.h> #endif @@ -99,8 +103,7 @@ struct unix_opt { struct semaphore readsem; struct sock * other; struct sock ** list; - int marksweep; -#define MARKED 1 + struct sock * gc_tree; int inflight; }; @@ -143,12 +146,11 @@ struct ipv6_pinfo { struct in6_addr daddr; struct in6_addr *daddr_cache; - __u32 flow_lbl; + __u32 flow_label; __u32 frag_size; int hop_limit; int mcast_hops; int mcast_oif; - __u8 priority; /* pktoption flags */ union { @@ -159,7 +161,7 @@ struct ipv6_pinfo { hopopts:1, dstopts:1, authhdr:1, - unused:1; + rxflow:1; } bits; __u8 all; } rxopt; @@ -167,9 +169,11 @@ struct ipv6_pinfo { /* sockopt flags */ __u8 mc_loop:1, recverr:1, + sndflow:1, pmtudisc:2; struct ipv6_mc_socklist *ipv6_mc_list; + struct ipv6_fl_socklist *ipv6_fl_list; __u32 dst_cookie; struct ipv6_txoptions *opt; @@ -453,8 +457,7 @@ struct sock { #ifdef CONFIG_FILTER /* Socket Filtering Instructions */ - int filter; - struct sock_filter *filter_data; + struct sk_filter *filter; #endif /* CONFIG_FILTER */ /* This is where all the private (optional) areas that don't @@ -493,6 +496,9 @@ struct sock { #if defined(CONFIG_ECONET) || defined(CONFIG_ECONET_MODULE) struct econet_opt *af_econet; #endif +#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE) + struct irda_sock *irda; +#endif } protinfo; /* IP 'private area' or will be eventually. */ @@ -790,11 +796,11 @@ extern void sklist_destroy_socket(struct sock **list, struct sock *sk); * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller * than pkt_len we keep whole skb->data. */ -extern __inline__ int sk_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) +extern __inline__ int sk_filter(struct sk_buff *skb, struct sk_filter *filter) { int pkt_len; - pkt_len = sk_run_filter(skb->data, skb->len, filter, flen); + pkt_len = sk_run_filter(skb, filter->insns, filter->len); if(!pkt_len) return 1; /* Toss Packet */ else @@ -802,6 +808,23 @@ extern __inline__ int sk_filter(struct sk_buff *skb, struct sock_filter *filter, return 0; } + +extern __inline__ void sk_filter_release(struct sock *sk, struct sk_filter *fp) +{ + unsigned int size = sk_filter_len(fp); + + atomic_sub(size, &sk->omem_alloc); + + if (atomic_dec_and_test(&fp->refcnt)) + kfree_s(fp, size); +} + +extern __inline__ void sk_filter_charge(struct sock *sk, struct sk_filter *fp) +{ + atomic_inc(&fp->refcnt); + atomic_add(sk_filter_len(fp), &sk->omem_alloc); +} + #endif /* CONFIG_FILTER */ /* @@ -830,6 +853,9 @@ extern __inline__ void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { +#ifdef CONFIG_FILTER + struct sk_filter *filter; +#endif /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces number of warnings when compiling with -W --ANK */ @@ -837,11 +863,8 @@ extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) return -ENOMEM; #ifdef CONFIG_FILTER - if (sk->filter) - { - if (sk_filter(skb, sk->filter_data, sk->filter)) - return -EPERM; /* Toss packet */ - } + if ((filter = sk->filter) != NULL && sk_filter(skb, filter)) + return -EPERM; /* Toss packet */ #endif /* CONFIG_FILTER */ skb_set_owner_r(skb, sk); @@ -906,6 +929,10 @@ extern void net_delete_timer (struct sock *); extern void net_reset_timer (struct sock *, int, unsigned long); extern void net_timer (unsigned long); +extern __inline__ int gfp_any(void) +{ + return in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; +} /* * Enable debug/info messages diff --git a/include/net/tcp.h b/include/net/tcp.h index 5da07ba9d..2d91a8d43 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -174,6 +174,7 @@ struct tcp_tw_bucket { struct tcp_func *af_specific; struct tcp_bind_bucket *tb; struct tcp_tw_bucket *next_death; + struct tcp_tw_bucket **pprev_death; int death_slot; #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) struct in6_addr v6_daddr; @@ -487,9 +488,7 @@ extern void tcp_shutdown (struct sock *sk, int how); extern int tcp_v4_rcv(struct sk_buff *skb, unsigned short len); -extern int tcp_do_sendmsg(struct sock *sk, - int iovlen, struct iovec *iov, - int flags); +extern int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg); extern int tcp_ioctl(struct sock *sk, int cmd, @@ -718,6 +717,30 @@ extern __inline__ int tcp_raise_window(struct sock *sk) return (new_win && (new_win > (cur_win << 1))); } +/* Recalculate snd_ssthresh, we want to set it to: + * + * one half the current congestion window, but no + * less than two segments + * + * We must take into account the current send window + * as well, however we keep track of that using different + * units so a conversion is necessary. -DaveM + */ +extern __inline__ __u32 tcp_recalc_ssthresh(struct tcp_opt *tp) +{ + __u32 snd_wnd_packets = tp->snd_wnd / tp->mss_cache; + + return max(min(snd_wnd_packets, tp->snd_cwnd) >> 1, 2); +} + +/* TCP timestamps are only 32-bits, this causes a slight + * complication on 64-bit systems since we store a snapshot + * of jiffies in the buffer control blocks below. We decidely + * only use of the low 32-bits of jiffies and hide the ugly + * casts with the following macro. + */ +#define tcp_time_stamp ((__u32)(jiffies)) + /* This is what the send packet queueing engine uses to pass * TCP per-packet control information to the transmission * code. We also store the host-order sequence numbers in @@ -734,7 +757,7 @@ struct tcp_skb_cb { } header; /* For incoming frames */ __u32 seq; /* Starting sequence number */ __u32 end_seq; /* SEQ + FIN + SYN + datalen */ - unsigned long when; /* used to compute rtt's */ + __u32 when; /* used to compute rtt's */ __u8 flags; /* TCP header flags. */ /* NOTE: These must match up to the flags byte in a @@ -795,21 +818,43 @@ static __inline__ int tcp_snd_test(struct sock *sk, struct sk_buff *skb) * c) We are retransmiting [Nagle] * d) We have too many packets 'in flight' * - * Don't use the nagle rule for urgent data. + * Don't use the nagle rule for urgent data (or + * for the final FIN -DaveM). */ if ((sk->nonagle == 2 && (skb->len < tp->mss_cache)) || (!sk->nonagle && skb->len < (tp->mss_cache >> 1) && tp->packets_out && - !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_URG))) + !(TCP_SKB_CB(skb)->flags & (TCPCB_FLAG_URG|TCPCB_FLAG_FIN)))) nagle_check = 0; + /* Don't be strict about the congestion window for the + * final FIN frame. -DaveM + */ return (nagle_check && - (tcp_packets_in_flight(tp) < tp->snd_cwnd) && + ((tcp_packets_in_flight(tp) < tp->snd_cwnd) || + (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) && !after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) && tp->retransmits == 0); } +/* Push out any pending frames which were held back due to + * TCP_CORK or attempt at coalescing tiny packets. + * The socket must be locked by the caller. + */ +static __inline__ void tcp_push_pending_frames(struct sock *sk, struct tcp_opt *tp) +{ + if(tp->send_head) { + if(tcp_snd_test(sk, tp->send_head)) + tcp_write_xmit(sk); + else if(tp->packets_out == 0 && !tp->pending) { + /* We held off on this in tcp_send_skb() */ + tp->pending = TIME_PROBE0; + tcp_reset_xmit_timer(sk, TIME_PROBE0, tp->rto); + } + } +} + /* This tells the input processing path that an ACK should go out * right now. */ @@ -912,7 +957,7 @@ static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_opt * * can generate. */ extern __inline__ void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack, - int offer_wscale, int wscale, __u32 tstamp) + int offer_wscale, int wscale, __u32 tstamp, __u32 ts_recent) { /* We always get an MSS option. * The option bytes which will be seen in normal data @@ -936,7 +981,7 @@ extern __inline__ void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sa *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); *ptr++ = htonl(tstamp); /* TSVAL */ - *ptr++ = __constant_htonl(0); /* TSECR */ + *ptr++ = htonl(ts_recent); /* TSECR */ } else if(sack) *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_SACK_PERM << 8) | TCPOLEN_SACK_PERM); diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index b697d7c3c..d49bc86e0 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -13,6 +13,8 @@ extern struct proto rawv6_prot; extern struct proto udpv6_prot; extern struct proto tcpv6_prot; +struct flowi; + extern void rawv6_init(void); extern void udpv6_init(void); extern void tcpv6_init(void); @@ -26,8 +28,7 @@ extern int datagram_recv_ctl(struct sock *sk, struct sk_buff *skb); extern int datagram_send_ctl(struct msghdr *msg, - int *oif, - struct in6_addr **src_addr, + struct flowi *fl, struct ipv6_txoptions *opt, int *hlimit); diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 36492f862..086ad3681 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -133,6 +133,7 @@ #define TYPE_MOD 0x07 /* Magneto-optical disk - * - treated as TYPE_DISK */ #define TYPE_MEDIUM_CHANGER 0x08 +#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ #define TYPE_NO_LUN 0x7f /* diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 44c7dd051..3e112c659 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -1,34 +1,163 @@ +#ifndef _SCSI_GENERIC_H +#define _SCSI_GENERIC_H + /* History: Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user - process control of SCSI devices. + process control of SCSI devices. Development Sponsored by Killy Corp. NY NY -*/ +Original driver (sg.h): +* Copyright (C) 1992 Lawrence Foard +2.x extensions to driver: +* Copyright (C) 1998, 1999 Douglas Gilbert -#ifndef _SCSI_GENERIC_H -#define _SCSI_GENERIC_H -/* - An SG device is accessed by writing "packets" to it, the replies - are then read using the read call. The same header is used for - reply, just ignore reply_len field. + Version: 2.1.32 (990501) + This version for later 2.1.x series and 2.2.x kernels + D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au) + + Changes since 2.1.31 (990327) + - add ioctls SG_GET_UNDERRUN_FLAG and _SET_. Change the default + to _not_ flag underruns (affects aic7xxx driver) + - clean up logging of pointers to use %p (for 64 bit architectures) + - rework usage of get_user/copy_to_user family of kernel calls + - "disown" scsi_command blocks before releasing them + Changes since 2.1.30 (990320) + - memory tweaks: change flags on kmalloc (GFP_KERNEL to GFP_ATOMIC) + - increase max allowable mid-level pool usage + Changes since 2.1.21 (990315) + - skipped to 2.1.30 indicating interface change (revert to 2.1.9) + - remove attempt to accomodate cdrecord 1.8, will fix app + - keep SG_?ET_RESERVED_SIZE naming for clarity + Changes since 2.1.20 (990313) + - ommission: left out logic for SG_?ET_ALT_INTERFACE, now added + Changes since 2.1.9 (990309) + - skipped to version 2.1.20 to indicate some interface changes + - incorporate sg changes to make cdrecord 1.8 work (had its + own patches that were different from the original) + - change SG_?ET_BUFF_SIZE to SG_?ET_RESERVED_SIZE for clarity + Changes since 2.1.8 (990303) + - debug ">9" option dumps debug for _all_ active sg devices + - increase allowable dma pool usage + increase minimum threshhold + - pad out sg_scsi_id structure + Changes since 2.1.7 (990227) + - command queuing now "non-default" [back. compat. with cdparanoia] + - Tighten access on some ioctls + + + New features and changes: + - per file descriptor (fd) write-read sequencing and command queues. + - command queuing supported (SG_MAX_QUEUE is maximum per fd). + - scatter-gather supported (allowing potentially megabyte transfers). + - the SCSI target, host and driver status are returned + in unused fields of sg_header (maintaining its original size). + - asynchronous notification support added (SIGPOLL, SIGIO) for + read()s ( write()s should never block). + - pack_id logic added so read() can be made to wait for a specific + pack_id. + - uses memory > ISA_DMA_THRESHOLD if adapter allows it (e.g. a + pci scsi adapter). + - this driver no longer uses a single SG_BIG_BUFF sized buffer + obtained at driver/module init time. Rather it obtains a + SG_SCATTER_SZ buffer when a fd is open()ed and frees it at + the corresponding release() (ie pr fd). Hence open() can return + ENOMEM! If write() request > SG_SCATTER_SZ bytes for data then + it can fail with ENOMEM as well (if so, scale back). + - adds several ioctl calls, see ioctl section below. + - SG_SCATTER_SZ's presence indicates this version of "sg" driver. + + Good documentation on the original "sg" device interface and usage can be + found in the Linux HOWTO document: "SCSI Programming HOWTO" by Heiko + Eissfeldt; last updated 7 May 1996. I will add more info on using the + extensions in this driver as required. A quick summary: + An SG device is accessed by writing SCSI commands plus any associated + outgoing data to it; the resulting status codes and any incoming data + are then obtained by a read call. The device can be opened O_NONBLOCK + (non-blocking) and poll() used to monitor its progress. The device may be + opened O_EXCL which excludes other "sg" users from this device (but not + "sd", "st" or "sr" users). The buffer given to the write() call is made + up as follows: + - struct sg_header image (see below) + - scsi command (6, 10 or 12 bytes long) + - data to be written to the device (if any) + + The buffer received from the corresponding read() call contains: + - struct sg_header image (check results + sense_buffer) + - data read back from device (if any) + + The given SCSI command has its LUN field overwritten internally by the + value associated with the device that has been opened. + + Memory (RAM) is used within this driver for direct memory access (DMA) + in transferring data to and from the SCSI device. The dreaded ENOMEM + seems to be more prevalent under early 2.2.x kernels than under the + 2.0.x kernel series. For a given (large) transfer the memory obtained by + this driver must be contiguous or scatter-gather must be used (if + supported by the adapter). [Furthermore, ISA SCSI adapters can only use + memory below the 16MB level on a i386.] + This driver tries hard to find some suitable memory before admitting + defeat and returning ENOMEM. All is not lost if application writers + then back off the amount they are requesting. The value returned by + the SG_GET_RESERVED_SIZE ioctl is guaranteed to be available (one + per fd). This driver does the following: + - attempts to reserve a SG_SCATTER_SZ sized buffer on open(). The + actual amount reserved is given by the SG_GET_RESERVED_SIZE ioctl(). + - each write() needs to reserve a DMA buffer of the size of the + data buffer indicated (excluding sg_header and command overhead). + This buffer, depending on its size, adapter type (ISA or not) and + the amount of memory available will be obtained from the kernel + directly (get_free_pages or kmalloc) or the from the scsi mid-level + dma pool (taking care not to exhaust it). + If the buffer requested is > SG_SCATTER_SZ or memory is tight then + scatter-gather will be used if supported by the adapter. + - write() will also attempt to use the buffer reserved on open() + if it is large enough. + The above strategy ensures that a write() can always depend on a buffer + of the size indicated by the SG_GET_RESERVED_SIZE ioctl() (which could be + 0, but at least the app knows things are tight in advance). + Hence application writers can adopt quite aggressive strategies (e.g. + requesting 512KB) and scale them back in the face of ENOMEM errors. + N.B. Queuing up commands also ties up kernel memory. + + More documentation can be found at www.torque.net/sg */ +#define SG_MAX_SENSE 16 /* too little, unlikely to change in 2.2.x */ + struct sg_header - { - int pack_len; /* length of incoming packet <4096 (including header) */ - int reply_len; /* maximum length <4096 of expected reply */ - int pack_id; /* id number of packet */ - int result; /* 0==ok, otherwise refer to errno codes */ - unsigned int twelve_byte:1; /* Force 12 byte command length for group 6 & 7 commands */ - unsigned int other_flags:31; /* for future use */ - unsigned char sense_buffer[16]; /* used only by reads */ - /* command follows then data for command */ - }; - -/* ioctl's */ -#define SG_SET_TIMEOUT 0x2201 /* set timeout *(int *)arg==timeout */ -#define SG_GET_TIMEOUT 0x2202 /* get timeout return timeout */ +{ + int pack_len; /* [o] reply_len (ie useless), ignored as input */ + int reply_len; /* [i] max length of expected reply (inc. sg_header) */ + int pack_id; /* [io] id number of packet (use ints >= 0) */ + int result; /* [o] 0==ok, else (+ve) Unix errno code (e.g. EIO) */ + unsigned int twelve_byte:1; + /* [i] Force 12 byte command length for group 6 & 7 commands */ + unsigned int target_status:5; /* [o] scsi status from target */ + unsigned int host_status:8; /* [o] host status (see "DID" codes) */ + unsigned int driver_status:8; /* [o] driver status+suggestion */ + unsigned int other_flags:10; /* unused */ + unsigned char sense_buffer[SG_MAX_SENSE]; /* [o] Output in 3 cases: + when target_status is CHECK_CONDITION or + when target_status is COMMAND_TERMINATED or + when (driver_status & DRIVER_SENSE) is true. */ +}; /* This structure is 36 bytes long on i386 */ + + +typedef struct sg_scsi_id { + int host_no; /* as in "scsi<n>" where 'n' is one of 0, 1, 2 etc */ + int channel; + int scsi_id; /* scsi id of target device */ + int lun; + int scsi_type; /* TYPE_... defined in scsi/scsi.h */ + int unused1; /* probably find a good use, set 0 for now */ + int unused2; /* ditto */ + int unused3; +} Sg_scsi_id; + +/* ioctls ( _GET_s yield result via 'int *' 3rd argument unless + otherwise indicated */ +#define SG_SET_TIMEOUT 0x2201 /* unit: jiffies, 10ms on i386 */ +#define SG_GET_TIMEOUT 0x2202 /* yield timeout as _return_ value */ #define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ @@ -36,12 +165,72 @@ struct sg_header #define SG_SET_TRANSFORM 0x2204 #define SG_GET_TRANSFORM 0x2205 -#define SG_DEFAULT_TIMEOUT (60*HZ) /* 1 minute timeout */ +#define SG_SET_RESERVED_SIZE 0x2275 /* currently ignored, future addition */ +/* Following yields buffer reserved by open(): 0 <= x <= SG_SCATTER_SZ */ +#define SG_GET_RESERVED_SIZE 0x2272 + +/* The following ioctl takes a 'Sg_scsi_id *' object as its 3rd argument. */ +#define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus,chan,dev,lun+type */ +/* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */ + +/* Override adapter setting and always DMA using low memory ( <16MB on i386). + Default is 0 (off - use adapter setting) */ +#define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */ +#define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */ + +/* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which + will attempt to read that pack_id or block (or return EAGAIN). If + pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0 + (default) then pack_id ignored by read() and oldest readable fetched. */ +#define SG_SET_FORCE_PACK_ID 0x227b +#define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */ + +#define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */ + +/* Turn on error sense trace (1..8), dump this device to log/console (9) + or dump all sg device states ( >9 ) to log/console */ +#define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */ + +/* Yields max scatter gather tablesize allowed by current host adapter */ +#define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ + +/* Control whether sequencing per file descriptor (default) or per device */ +#define SG_GET_MERGE_FD 0x2274 /* 0-> per fd (default), 1-> per device */ +#define SG_SET_MERGE_FD 0x2273 /* Attempt to change sequencing state, + if more than 1 fd open on device, will fail with EBUSY */ + +/* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q) */ +#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on) */ +#define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1 */ + +/* Get/set whether DMA underrun will cause an error (DID_ERROR) [this only + currently applies to the [much-used] aic7xxx driver) */ +#define SG_GET_UNDERRUN_FLAG 0x2280 /* Yields 0 (don't flag) or 1 (flag) */ +#define SG_SET_UNDERRUN_FLAG 0x2281 /* Change flag underrun state */ + + +#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ #define SG_DEFAULT_RETRIES 1 -#define SG_MAX_QUEUE 4 /* maximum outstanding request, arbitrary, may be - changed if sufficient DMA buffer room available */ +/* Default modes, commented if they differ from original sg driver */ +#define SG_DEF_COMMAND_Q 0 +#define SG_DEF_MERGE_FD 0 /* was 1 -> per device sequencing */ +#define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */ +#define SG_DEF_FORCE_PACK_ID 0 +#define SG_DEF_UNDERRUN_FLAG 0 + +/* maximum outstanding requests, write() yields EDOM if exceeded */ +#define SG_MAX_QUEUE 16 + +#define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ +/* Largest size (in bytes) a single scatter-gather list element can have. + The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on + i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported + by adapter then this value is the largest data block that can be + read/written by a single scsi command. Max number of scatter-gather + list elements seems to be limited to 255. */ -#define SG_BIG_BUFF 32768 +#define SG_BIG_BUFF SG_SCATTER_SZ /* for backward compatibility */ +/* #define SG_BIG_BUFF (SG_SCATTER_SZ * 8) */ /* =256KB, if you want */ #endif diff --git a/include/video/fbcon.h b/include/video/fbcon.h index 4fe4eb7eb..812a2ff9b 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -13,6 +13,7 @@ #include <linux/config.h> #include <linux/console_struct.h> +#include <linux/vt_buffer.h> /* diff --git a/include/video/sbusfb.h b/include/video/sbusfb.h index 2a6d91215..2511cbd5f 100644 --- a/include/video/sbusfb.h +++ b/include/video/sbusfb.h @@ -15,8 +15,12 @@ struct bt_regs { struct fb_info_creator { struct ffb_fbc *fbc; struct ffb_dac *dac; - int dac_rev; int xy_margin; + int fifo_cache; + u64 yx_margin; + int fg_cache; + int bg_cache; + int dac_rev; }; struct fb_info_cgsix { struct bt_regs *bt; |