From 86464aed71025541805e7b1515541aee89879e33 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 15 Feb 1999 02:15:32 +0000 Subject: Merge with Linux 2.2.1. --- include/asm-m68k/bootinfo.h | 14 ----- include/asm-m68k/bvme6000hw.h | 22 +++++++- include/asm-m68k/entry.h | 119 +++++++++++++++++++---------------------- include/asm-m68k/ide.h | 2 +- include/asm-m68k/init.h | 6 ++- include/asm-m68k/io.h | 29 ++++++++++ include/asm-m68k/ipc.h | 3 ++ include/asm-m68k/keyboard.h | 6 +-- include/asm-m68k/machdep.h | 1 - include/asm-m68k/machw.h | 12 +++++ include/asm-m68k/page.h | 4 +- include/asm-m68k/pgtable.h | 81 +++++----------------------- include/asm-m68k/processor.h | 5 +- include/asm-m68k/resource.h | 2 +- include/asm-m68k/semaphore.h | 40 +++++++++++--- include/asm-m68k/setup.h | 18 ++++--- include/asm-m68k/softirq.h | 6 +-- include/asm-m68k/spinlock.h | 13 +++-- include/asm-m68k/string.h | 6 +-- include/asm-m68k/system.h | 9 ++-- include/asm-m68k/termbits.h | 19 +++++-- include/asm-m68k/termios.h | 2 + include/asm-m68k/timex.h | 7 +++ include/asm-m68k/traps.h | 9 ++++ include/asm-m68k/uaccess.h | 7 +-- include/asm-m68k/unistd.h | 44 +-------------- include/asm-m68k/virtconvert.h | 2 +- 27 files changed, 252 insertions(+), 236 deletions(-) (limited to 'include/asm-m68k') diff --git a/include/asm-m68k/bootinfo.h b/include/asm-m68k/bootinfo.h index c0a7e6cb0..74930a381 100644 --- a/include/asm-m68k/bootinfo.h +++ b/include/asm-m68k/bootinfo.h @@ -46,12 +46,6 @@ struct bi_record { unsigned long data[0]; /* data */ }; -#else /* __ASSEMBLY__ */ - -BIR_tag = 0 -BIR_size = BIR_tag+2 -BIR_data = BIR_size+2 - #endif /* __ASSEMBLY__ */ @@ -287,14 +281,6 @@ struct compat_bi_Macintosh unsigned long adbdelay; unsigned long timedbra; }; -#else - -#define BI_videoaddr BI_un -#define BI_videorow BI_videoaddr+4 -#define BI_videodepth BI_videorow+4 -#define BI_dimensions BI_videodepth+4 -#define BI_args BI_dimensions+4 -#define BI_cpuid BI_args+56 #endif diff --git a/include/asm-m68k/bvme6000hw.h b/include/asm-m68k/bvme6000hw.h index 0218c29dc..853120a04 100644 --- a/include/asm-m68k/bvme6000hw.h +++ b/include/asm-m68k/bvme6000hw.h @@ -98,7 +98,7 @@ typedef struct { #define BVME_CONFIG_REG 0xff500003 -#define config_reg_ptr (unsigned char *)BVME_CONFIG_REG +#define config_reg_ptr (volatile unsigned char *)BVME_CONFIG_REG #define BVME_CONFIG_SW1 0x08 #define BVME_CONFIG_SW2 0x04 @@ -126,4 +126,24 @@ typedef struct { #define BVME_IRQ_SCCA_RX 0x4c #define BVME_IRQ_SCCA_SPCOND 0x4e +/* Address control registers */ + +#define BVME_ACR_A32VBA 0xff400003 +#define BVME_ACR_A32MSK 0xff410003 +#define BVME_ACR_A24VBA 0xff420003 +#define BVME_ACR_A24MSK 0xff430003 +#define BVME_ACR_A16VBA 0xff440003 +#define BVME_ACR_A32LBA 0xff450003 +#define BVME_ACR_A24LBA 0xff460003 +#define BVME_ACR_ADDRCTL 0xff470003 + +#define bvme_acr_a32vba *(volatile unsigned char *)BVME_ACR_A32VBA +#define bvme_acr_a32msk *(volatile unsigned char *)BVME_ACR_A32MSK +#define bvme_acr_a24vba *(volatile unsigned char *)BVME_ACR_A24VBA +#define bvme_acr_a24msk *(volatile unsigned char *)BVME_ACR_A24MSK +#define bvme_acr_a16vba *(volatile unsigned char *)BVME_ACR_A16VBA +#define bvme_acr_a32lba *(volatile unsigned char *)BVME_ACR_A32LBA +#define bvme_acr_a24lba *(volatile unsigned char *)BVME_ACR_A24LBA +#define bvme_acr_addrctl *(volatile unsigned char *)BVME_ACR_ADDRCTL + #endif diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h index b1c102ce2..647764bd1 100644 --- a/include/asm-m68k/entry.h +++ b/include/asm-m68k/entry.h @@ -37,25 +37,8 @@ #define curptr a2 -/* - * these are offsets into the task-struct - */ -LTASK_STATE = 0 -LTASK_FLAGS = 4 -LTASK_SIGPENDING = 8 -LTASK_ADDRLIMIT = 12 -LTASK_EXECDOMAIN = 16 -LTASK_NEEDRESCHED = 20 - -LTSS_KSP = 0 -LTSS_USP = 4 -LTSS_SR = 8 -LTSS_FS = 10 -LTSS_CRP = 12 -LTSS_FPCTXT = 24 - /* the following macro is used when enabling interrupts */ -#if defined(CONFIG_ATARI_ONLY) && !defined(CONFIG_HADES) +#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) /* block out HSYNC on the atari */ #define ALLOWINT 0xfbff #define MAX_NOINT_IPL 3 @@ -65,22 +48,20 @@ LTSS_FPCTXT = 24 #define MAX_NOINT_IPL 0 #endif /* machine compilation types */ -LPT_OFF_D0 = 0x20 -LPT_OFF_ORIG_D0 = 0x24 -LPT_OFF_SR = 0x2C -LPT_OFF_FORMATVEC = 0x32 - LFLUSH_I_AND_D = 0x00000808 -LENOSYS = 38 LSIGTRAP = 5 -LPF_TRACESYS_OFF = 3 -LPF_TRACESYS_BIT = 5 -LPF_PTRACED_OFF = 3 -LPF_PTRACED_BIT = 4 -LPF_DTRACE_OFF = 1 -LPF_DTRACE_BIT = 5 - +/* process bits for task_struct.flags */ +PF_TRACESYS_OFF = 3 +PF_TRACESYS_BIT = 5 +PF_PTRACED_OFF = 3 +PF_PTRACED_BIT = 4 +PF_DTRACE_OFF = 1 +PF_DTRACE_BIT = 5 + +#define SAVE_ALL_INT save_all_int +#define SAVE_ALL_SYS save_all_sys +#define RESTORE_ALL restore_all /* * This defines the normal kernel pt-regs layout. * @@ -92,56 +73,68 @@ LPF_DTRACE_BIT = 5 * a -1 in the orig_d0 field signifies * that the stack frame is NOT for syscall */ -#define SAVE_ALL_INT \ - clrl %sp@-; /* stk_adj */ \ - pea -1:w; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ +.macro save_all_int + clrl %sp@- | stk_adj + pea -1:w | orig d0 + movel %d0,%sp@- | d0 moveml %d1-%d5/%a0-%a1/%curptr,%sp@- +.endm -#define SAVE_ALL_SYS \ - clrl %sp@-; /* stk_adj */ \ - movel %d0,%sp@-; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ - moveml %d1-%d5/%a0-%a1/%curptr,%sp@- +.macro save_all_sys + clrl %sp@- | stk_adj + movel %d0,%sp@- | orig d0 + movel %d0,%sp@- | d0 + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- +.endm #else /* Need to save the "missing" registers for kgdb... */ -#define SAVE_ALL_INT \ - clrl %sp@-; /* stk_adj */ \ - pea -1:w; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ - moveml %d1-%d5/%a0-%a1/%curptr,%sp@-; \ - moveml %d6-%d7,kgdb_registers+GDBOFFA_D6; \ +.macro save_all_int + clrl %sp@- | stk_adj + pea -1:w | orig d0 + movel %d0,%sp@- | d0 + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- + moveml %d6-%d7,kgdb_registers+GDBOFFA_D6 moveml %a3-%a6,kgdb_registers+GDBOFFA_A3 +.endm -#define SAVE_ALL_SYS \ - clrl %sp@-; /* stk_adj */ \ - movel %d0,%sp@-; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ - moveml %d1-%d5/%a0-%a1/%curptr,%sp@-; \ - moveml %d6-%d7,kgdb_registers+GDBOFFA_D6; \ +.macro save_all_sys + clrl %sp@- | stk_adj + movel %d0,%sp@- | orig d0 + movel %d0,%sp@- | d0 + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- + moveml %d6-%d7,kgdb_registers+GDBOFFA_D6 moveml %a3-%a6,kgdb_registers+GDBOFFA_A3 +.endm #endif -#define RESTORE_ALL \ - moveml %sp@+,%a0-%a1/%curptr/%d1-%d5; \ - movel %sp@+,%d0; \ - addql #4,%sp; /* orig d0 */ \ - addl %sp@+,%sp; /* stk adj */ \ +.macro restore_all + moveml %sp@+,%a0-%a1/%curptr/%d1-%d5 + movel %sp@+,%d0 + addql #4,%sp | orig d0 + addl %sp@+,%sp | stk adj rte +.endm #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */ -#define SAVE_SWITCH_STACK \ +#define SAVE_SWITCH_STACK save_switch_stack +#define RESTORE_SWITCH_STACK restore_switch_stack +#define GET_CURRENT(tmp) get_current tmp + +.macro save_switch_stack moveml %a3-%a6/%d6-%d7,%sp@- +.endm -#define RESTORE_SWITCH_STACK \ +.macro restore_switch_stack moveml %sp@+,%a3-%a6/%d6-%d7 +.endm -#define GET_CURRENT(tmp) \ - movel %sp,tmp; \ - andw &-8192,tmp; \ - movel tmp,%curptr; +.macro get_current reg=%d0 + movel %sp,\reg + andw #-8192,\reg + movel \reg,%curptr +.endm #else /* C source */ diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h index 6fa31e040..a590528a7 100644 --- a/include/asm-m68k/ide.h +++ b/include/asm-m68k/ide.h @@ -449,7 +449,7 @@ static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, * an interrupt, and in that case it does nothing. Hope that is reasonable and * works. (Roman) */ -#ifdef CONFIG_ATARI_ONLY +#ifdef MACH_ATARI_ONLY #define ide__sti() \ do { \ if (!in_interrupt()) __sti(); \ diff --git a/include/asm-m68k/init.h b/include/asm-m68k/init.h index 9d366561a..022300376 100644 --- a/include/asm-m68k/init.h +++ b/include/asm-m68k/init.h @@ -15,6 +15,9 @@ #define __FINIT .previous #define __INITDATA .section ".data.init",#alloc,#write +#define __cacheline_aligned __attribute__ \ + ((__aligned__(16), __section__ (".data.cacheline_aligned"))) + #else /* gdb doesn't like it all if the code for one source file isn't together in @@ -27,7 +30,8 @@ #define __INIT #define __FINIT #define __INITDATA +#define __cacheline_aligned __attribute__ ((__aligned__(16))) #endif /* CONFIG_KGDB */ - + #endif diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index d60096384..168077b26 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h @@ -43,6 +43,35 @@ #define outb(x,addr) ((void) writeb(x,addr)) #define outb_p(x,addr) outb(x,addr) + +/* Values for nocacheflag and cmode */ +#define IOMAP_FULL_CACHING 0 +#define IOMAP_NOCACHE_SER 1 +#define IOMAP_NOCACHE_NONSER 2 +#define IOMAP_WRITETHROUGH 3 + +extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag); +extern void __iounmap(void *addr, unsigned long size); + +extern inline void *ioremap(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); +} +extern inline void *ioremap_nocache(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); +} +extern inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); +} +extern inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_FULL_CACHING); +} + +extern void iounmap(void *addr); + #endif /* __KERNEL__ */ #endif /* _M68K_IO_H */ diff --git a/include/asm-m68k/ipc.h b/include/asm-m68k/ipc.h index f1a75cc1d..96441c86c 100644 --- a/include/asm-m68k/ipc.h +++ b/include/asm-m68k/ipc.h @@ -23,6 +23,9 @@ struct ipc_kludge { #define SHMGET 23 #define SHMCTL 24 +/* Used by the DIPC package, try and avoid reusing it */ +#define DIPC 25 + #define IPCCALL(version,op) ((version)<<16 | (op)) #endif diff --git a/include/asm-m68k/keyboard.h b/include/asm-m68k/keyboard.h index c30c8dc04..eccadf2e3 100644 --- a/include/asm-m68k/keyboard.h +++ b/include/asm-m68k/keyboard.h @@ -52,9 +52,9 @@ static __inline__ void kbd_leds(unsigned char leds) #ifdef CONFIG_MAGIC_SYSRQ #define kbd_is_sysrq(keycode) ((keycode) == mach_sysrq_key && \ - (up_flag || \ - (shift_state & mach_sysrq_shift_mask) == \ - mach_sysrq_shift_state)) + (up_flag || \ + (shift_state & mach_sysrq_shift_mask) == \ + mach_sysrq_shift_state)) #define kbd_sysrq_xlate mach_sysrq_xlate #endif diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h index 2d8959093..ff785fb6e 100644 --- a/include/asm-m68k/machdep.h +++ b/include/asm-m68k/machdep.h @@ -13,7 +13,6 @@ extern void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)); extern int (*mach_keyb_init) (void); extern int (*mach_kbdrate) (struct kbd_repeat *); extern void (*mach_kbd_leds) (unsigned int); -extern void (*kbd_reset_setup) (char *, int); /* machine dependent irq functions */ extern void (*mach_init_IRQ) (void); extern void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h index 90ff6b627..56da64f3b 100644 --- a/include/asm-m68k/machw.h +++ b/include/asm-m68k/machw.h @@ -13,6 +13,16 @@ #ifndef _ASM_MACHW_H_ #define _ASM_MACHW_H_ +/* + * head.S maps the videomem to VIDEOMEMBASE + */ + +#define VIDEOMEMBASE 0xf0000000 +#define VIDEOMEMSIZE (4096*1024) +#define VIDEOMEMMASK (-4096*1024) + +#ifndef __ASSEMBLY__ + #include /* Mac SCSI Controller 5380 */ @@ -143,4 +153,6 @@ struct { /* extern struct mac_hw_present mac_hw_present; */ +#endif /* __ASSEMBLY__ */ + #endif /* linux/machw.h */ diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index f9f50bff7..a3fe87e71 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -8,7 +8,7 @@ #ifdef __KERNEL__ -#include +#include #define STRICT_MM_TYPECHECKS @@ -18,7 +18,7 @@ /* * We don't need to check for alignment etc. */ -#if defined(CONFIG_OPTIMIZE_040) || defined(CONFIG_OPTIMIZE_060) +#ifdef CPU_M68040_OR_M68060_ONLY static inline void copy_page(unsigned long to, unsigned long from) { unsigned long tmp; diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index 1dbc17608..a3487fb9d 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h @@ -13,14 +13,7 @@ * the m68k page table tree. */ -/* For virtual address to physical address conversion */ -extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const)); -extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const)); - -#include - -#define VTOP(addr) (mm_vtop((unsigned long)(addr))) -#define PTOV(addr) (mm_ptov((unsigned long)(addr))) +#include /* * Cache handling functions @@ -428,7 +421,7 @@ extern pte_t * __bad_pagetable(void); #define mk_pte(page, pgprot) \ ({ pte_t __pte; pte_val(__pte) = virt_to_phys((void *)page) + pgprot_val(pgprot); __pte; }) #define mk_pte_phys(physpage, pgprot) \ -({ pte_t __pte; pte_val(__pte) = virt_to_phys((void *)physpage) + pgprot_val(pgprot); __pte; }) +({ pte_t __pte; pte_val(__pte) = (unsigned long)physpage + pgprot_val(pgprot); __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; } @@ -436,34 +429,24 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) { int i; - - ptep = (pte_t *) virt_to_phys(ptep); - for (i = 0; i < 16; i++, ptep += PTRS_PER_PTE/16) - pmdp->pmd[i] = _PAGE_TABLE | _PAGE_ACCESSED | (unsigned long)ptep; -} - -/* early termination version of the above */ -extern inline void pmd_set_et(pmd_t * pmdp, pte_t * ptep) -{ - int i; - - ptep = (pte_t *) virt_to_phys(ptep); - for (i = 0; i < 16; i++, ptep += PTRS_PER_PTE/16) - pmdp->pmd[i] = _PAGE_PRESENT | _PAGE_ACCESSED | (unsigned long)ptep; + unsigned long ptbl; + ptbl = virt_to_phys(ptep); + for (i = 0; i < 16; i++, ptbl += sizeof(pte_table)/16) + pmdp->pmd[i] = _PAGE_TABLE | _PAGE_ACCESSED | ptbl; } extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) { pgd_val(*pgdp) = _PAGE_TABLE | _PAGE_ACCESSED | virt_to_phys(pmdp); } extern inline unsigned long pte_page(pte_t pte) -{ return (unsigned long)phys_to_virt((unsigned long)(pte_val(pte) & PAGE_MASK)); } +{ return (unsigned long)phys_to_virt(pte_val(pte) & PAGE_MASK); } extern inline unsigned long pmd_page2(pmd_t *pmd) -{ return (unsigned long)phys_to_virt((unsigned long)(pmd_val(*pmd) & _TABLE_MASK)); } +{ return (unsigned long)phys_to_virt(pmd_val(*pmd) & _TABLE_MASK); } #define pmd_page(pmd) pmd_page2(&(pmd)) extern inline unsigned long pgd_page(pgd_t pgd) -{ return (unsigned long)phys_to_virt((unsigned long)(pgd_val(pgd) & _TABLE_MASK)); } +{ return (unsigned long)phys_to_virt(pgd_val(pgd) & _TABLE_MASK); } 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 | _PAGE_FAKE_SUPER); } @@ -547,7 +530,7 @@ extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) return mm->pgd + (address >> PGDIR_SHIFT); } -extern pgd_t swapper_pg_dir[128]; +#define swapper_pg_dir kernel_pg_dir extern pgd_t kernel_pg_dir[128]; extern inline pgd_t * pgd_offset_k(unsigned long address) @@ -625,8 +608,6 @@ extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset); extern pmd_t *get_pointer_table(void); extern int free_pointer_table(pmd_t *); -extern pmd_t *get_kpointer_table(void); -extern void free_kpointer_table(pmd_t *); extern __inline__ pte_t *get_pte_fast(void) { @@ -754,29 +735,12 @@ extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) extern inline void pmd_free_kernel(pmd_t * pmd) { - free_kpointer_table(pmd); + free_pmd_fast(pmd); } extern inline pmd_t * pmd_alloc_kernel(pgd_t * pgd, unsigned long address) { - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_kpointer_table(); - if (pgd_none(*pgd)) { - if (page) { - pgd_set(pgd, page); - return page + address; - } - pgd_set(pgd, (pmd_t *)BAD_PAGETABLE); - return NULL; - } - free_kpointer_table(page); - } - if (pgd_bad(*pgd)) { - __bad_pmd(pgd); - return NULL; - } - return (pmd_t *) pgd_page(*pgd) + address; + return pmd_alloc(pgd, address); } extern inline void pgd_free(pgd_t * pgd) @@ -815,26 +779,7 @@ extern inline int mm_end_of_chunk (unsigned long addr, int len) int mm_end_of_chunk (unsigned long addr, int len); #endif -/* - * Map some physical address range into the kernel address space. - */ -extern unsigned long kernel_map(unsigned long paddr, unsigned long size, - int nocacheflag, unsigned long *memavailp ); -/* - * Unmap a region alloced by kernel_map(). - */ -extern void kernel_unmap( unsigned long addr ); -/* - * Change the cache mode of some kernel address range. - */ -extern void kernel_set_cachemode( unsigned long address, unsigned long size, - unsigned cmode ); - -/* Values for nocacheflag and cmode */ -#define KERNELMAP_FULL_CACHING 0 -#define KERNELMAP_NOCACHE_SER 1 -#define KERNELMAP_NOCACHE_NONSER 2 -#define KERNELMAP_NO_COPYBACK 3 +extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); /* * The m68k doesn't have any external MMU info: the kernel page diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 8246efd95..3fcf0670b 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h @@ -45,7 +45,7 @@ struct thread_struct { unsigned char fpstate[FPSTATESIZE]; /* floating point state */ }; -#define INIT_MMAP { &init_mm, 0, 0x40000000, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +#define INIT_MMAP { &init_mm, 0, 0x40000000, NULL, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_TSS { \ sizeof(init_stack) + (unsigned long) init_stack, 0, \ @@ -72,8 +72,11 @@ static inline void release_thread(struct task_struct *dead_task) { } +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); + #define copy_segments(nr, tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) /* * Free current thread data structures etc.. diff --git a/include/asm-m68k/resource.h b/include/asm-m68k/resource.h index f94ce2708..09ae4cfd2 100644 --- a/include/asm-m68k/resource.h +++ b/include/asm-m68k/resource.h @@ -25,7 +25,7 @@ {LONG_MAX, LONG_MAX}, \ {LONG_MAX, LONG_MAX}, \ {LONG_MAX, LONG_MAX}, \ - {_STK_LIM, _STK_LIM}, \ + {_STK_LIM, LONG_MAX}, \ { 0, LONG_MAX}, \ {LONG_MAX, LONG_MAX}, \ {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \ diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h index 50aabc1c8..9d05256df 100644 --- a/include/asm-m68k/semaphore.h +++ b/include/asm-m68k/semaphore.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -16,18 +17,30 @@ struct semaphore { atomic_t count; + unsigned long owner, owner_depth; atomic_t waking; 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 }) +/* + * 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 }) asmlinkage void __down_failed(void /* special register calling convention */); asmlinkage int __down_failed_interruptible(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); #define sema_init(sem, val) atomic_set(&((sem)->count), val) @@ -37,7 +50,7 @@ static inline void wake_one_more(struct semaphore * sem) atomic_inc(&sem->waking); } -static inline int waking_non_zero(struct semaphore *sem) +static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) { #ifndef CONFIG_RMW_INSNS unsigned long flags; @@ -45,7 +58,9 @@ static inline int waking_non_zero(struct semaphore *sem) save_flags(flags); cli(); - if (atomic_read(&sem->waking) > 0) { + 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; } @@ -55,7 +70,7 @@ static inline int waking_non_zero(struct semaphore *sem) __asm__ __volatile__ ("1: movel %2,%0\n" - " jeq 3f\n" + " jeq 3f\n" "2: movel %0,%1\n" " subql #1,%1\n" " casl %0,%1,%2\n" @@ -64,6 +79,13 @@ static inline int waking_non_zero(struct semaphore *sem) " 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; } @@ -79,7 +101,9 @@ extern inline void down(struct semaphore * sem) __asm__ __volatile__( "| atomic down operation\n\t" "subql #1,%0@\n\t" - "jmi 2f\n" + "jmi 2f\n\t" + "movel %%sp,4(%0)\n" + "movel #1,8(%0)\n\t" "1:\n" ".section .text.lock,\"ax\"\n" ".even\n" @@ -100,6 +124,9 @@ 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" @@ -124,6 +151,7 @@ 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" diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h index bf3314c2a..197d96f1e 100644 --- a/include/asm-m68k/setup.h +++ b/include/asm-m68k/setup.h @@ -52,7 +52,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_AMIGA (m68k_machtype == MACH_AMIGA) #else -# define CONFIG_AMIGA_ONLY +# define MACH_AMIGA_ONLY # define MACH_IS_AMIGA (1) # define MACH_TYPE (MACH_AMIGA) #endif @@ -63,7 +63,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_ATARI (m68k_machtype == MACH_ATARI) #else -# define CONFIG_ATARI_ONLY +# define MACH_ATARI_ONLY # define MACH_IS_ATARI (1) # define MACH_TYPE (MACH_ATARI) #endif @@ -74,7 +74,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_HP300) || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) # define MACH_IS_MAC (m68k_machtype == MACH_MAC) #else -# define CONFIG_MAC_ONLY +# define MACH_MAC_ONLY # define MACH_IS_MAC (1) # define MACH_TYPE (MACH_MAC) #endif @@ -91,7 +91,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_APOLLO (m68k_machtype == MACH_APOLLO) #else -# define CONFIG_APOLLO_ONLY +# define MACH_APOLLO_ONLY # define MACH_IS_APOLLO (1) # define MACH_TYPE (MACH_APOLLO) #endif @@ -102,7 +102,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_MVME16x (m68k_machtype == MACH_MVME16x) #else -# define CONFIG_MVME16x_ONLY +# define MACH_MVME16x_ONLY # define MACH_IS_MVME16x (1) # define MACH_TYPE (MACH_MVME16x) #endif @@ -113,7 +113,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) || defined(CONFIG_HP300) # define MACH_IS_BVME6000 (m68k_machtype == MACH_BVME6000) #else -# define CONFIG_BVME6000_ONLY +# define MACH_BVME6000_ONLY # define MACH_IS_BVME6000 (1) # define MACH_TYPE (MACH_BVME6000) #endif @@ -124,7 +124,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) # define MAC_IS_HP300 (m68k_machtype == MACH_HP300) #else -# define CONFIG_HP300_ONLY +# define MACH_HP300_ONLY # define MACH_IS_HP300 (1) # define MACH_TYPE (MACH_HP300) #endif @@ -260,6 +260,7 @@ extern int m68k_is040or060; #define CPU_TYPE (m68k_cputype) + /* * Miscellaneous */ @@ -268,7 +269,8 @@ extern int m68k_is040or060; #define CL_SIZE 256 #ifndef __ASSEMBLY__ -extern int m68k_num_memory; /* # of memory blocks found */ +extern int m68k_num_memory; /* # of memory blocks found (and used) */ +extern int m68k_realnum_memory; /* real # of memory blocks found */ extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */ struct mem_info { diff --git a/include/asm-m68k/softirq.h b/include/asm-m68k/softirq.h index 89c786665..dc5f56728 100644 --- a/include/asm-m68k/softirq.h +++ b/include/asm-m68k/softirq.h @@ -13,7 +13,7 @@ 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; } @@ -29,12 +29,12 @@ extern inline void mark_bh(int nr) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); } 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-m68k/spinlock.h b/include/asm-m68k/spinlock.h index 6c049a124..1c3ace986 100644 --- a/include/asm-m68k/spinlock.h +++ b/include/asm-m68k/spinlock.h @@ -10,10 +10,10 @@ */ #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) typedef struct { } spinlock_t; -#define SPIN_LOCK_UNLOCKED { } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { } #else typedef struct { int gcc_is_buggy; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0 } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #endif #define spin_lock_init(lock) do { } while(0) @@ -38,9 +38,16 @@ typedef struct { int gcc_is_buggy; } spinlock_t; * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. + * + * Gcc-2.7.x has a nasty bug with empty initializers. */ +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) typedef struct { } rwlock_t; -#define RW_LOCK_UNLOCKED { } +#define RW_LOCK_UNLOCKED (rwlock_t) { } +#else +typedef struct { int gcc_is_buggy; } rwlock_t; +#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } +#endif #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0) diff --git a/include/asm-m68k/string.h b/include/asm-m68k/string.h index 796f6f16e..710288a1a 100644 --- a/include/asm-m68k/string.h +++ b/include/asm-m68k/string.h @@ -1,7 +1,7 @@ #ifndef _M68K_STRING_H_ #define _M68K_STRING_H_ -#include +#include #include #define __HAVE_ARCH_STRCPY @@ -315,7 +315,7 @@ extern inline void * __memset_page(void * s,int c,size_t count) data = c | (c << 8); data |= data << 16; -#if defined(CONFIG_OPTIMIZE_040) || defined(CONFIG_OPTIMIZE_060) +#ifdef CPU_M68040_OR_M68060_ONLY if (((unsigned long) s) & 0x0f) memset(s, c, count); @@ -386,7 +386,7 @@ extern inline void * __memcpy_page(void * to, const void * from, size_t count) unsigned long tmp; void *xto = to; -#if defined(CONFIG_OPTIMIZE_040) || defined(CONFIG_OPTIMIZE_060) +#ifdef CPU_M68040_OR_M68060_ONLY if (((unsigned long) to | (unsigned long) from) & 0x0f) return memcpy(to, from, count); diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h index cee722633..86d3d38f1 100644 --- a/include/asm-m68k/system.h +++ b/include/asm-m68k/system.h @@ -46,11 +46,8 @@ asmlinkage void resume(void); #define switch_to(prev,next) { \ register void *_prev __asm__ ("a0") = (prev); \ register void *_next __asm__ ("a1") = (next); \ - register int _tssoff __asm__ ("d1") = (int)&((struct task_struct *)0)->tss; \ - register char _shared __asm__ ("d2") = ((prev)->mm == (next)->mm); \ - __asm__ __volatile__("jbsr " SYMBOL_NAME_STR(resume) "\n\t" \ - : : "a" (_prev), "a" (_next), "d" (_tssoff), \ - "d" (_shared) \ + __asm__ __volatile__("jbsr " SYMBOL_NAME_STR(resume) \ + : : "a" (_prev), "a" (_next) \ : "d0", "d1", "d2", "d3", "d4", "d5", "a0", "a1"); \ } @@ -60,7 +57,7 @@ asmlinkage void resume(void); struct __xchg_dummy { unsigned long a[100]; }; #define __xg(x) ((volatile struct __xchg_dummy *)(x)) -#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC) && !defined(CONFIG_HADES) && !defined(CONFIG_VME) && !defined(CONFIG_APOLLO) +#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) /* block out HSYNC on the atari */ #define __sti() __asm__ __volatile__ ("andiw #0xfbff,%/sr": : : "memory") #else /* portable version */ diff --git a/include/asm-m68k/termbits.h b/include/asm-m68k/termbits.h index 0a3080a76..c43bb869a 100644 --- a/include/asm-m68k/termbits.h +++ b/include/asm-m68k/termbits.h @@ -118,10 +118,21 @@ struct termios { #define HUPCL 0002000 #define CLOCAL 0004000 #define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 #define CIBAUD 002003600000 /* input baud rate (not used) */ #define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CRTSCTS 020000000000 /* flow control */ diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h index b17fed223..a65484efb 100644 --- a/include/asm-m68k/termios.h +++ b/include/asm-m68k/termios.h @@ -58,6 +58,8 @@ struct termio { #define N_MASC 8 /* Reserved for Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ +#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 */ #ifdef __KERNEL__ diff --git a/include/asm-m68k/timex.h b/include/asm-m68k/timex.h index fe5cff581..7a05262f2 100644 --- a/include/asm-m68k/timex.h +++ b/include/asm-m68k/timex.h @@ -12,4 +12,11 @@ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +typedef unsigned long cycles_t; + +static inline cycles_t get_cycles(void) +{ + return 0; +} + #endif diff --git a/include/asm-m68k/traps.h b/include/asm-m68k/traps.h index 5b12398f5..c4a7d6baa 100644 --- a/include/asm-m68k/traps.h +++ b/include/asm-m68k/traps.h @@ -11,10 +11,14 @@ #ifndef _M68K_TRAPS_H #define _M68K_TRAPS_H +#ifndef __ASSEMBLY__ + typedef void (*e_vector)(void); extern e_vector vectors[]; +#endif + #define VEC_BUSERR (2) #define VEC_ADDRERR (3) #define VEC_ILLEGAL (4) @@ -63,9 +67,12 @@ extern e_vector vectors[]; #define VEC_FPUNSUP (55) #define VEC_UNIMPEA (60) #define VEC_UNIMPII (61) +#define VEC_USER (64) #define VECOFF(vec) ((vec)<<2) +#ifndef __ASSEMBLY__ + /* Status register bits */ #define PS_T (0x8000) #define PS_S (0x2000) @@ -238,4 +245,6 @@ struct frame { } un; }; +#endif /* __ASSEMBLY__ */ + #endif /* _M68K_TRAPS_H */ diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h index a477bce01..aa1b4494f 100644 --- a/include/asm-m68k/uaccess.h +++ b/include/asm-m68k/uaccess.h @@ -184,7 +184,7 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n) " .long 5b,9b\n" ".previous" : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) - : "r"(n & 3), "0"(to), "1"(from), "2"(n/4) + : "d"(n & 3), "0"(to), "1"(from), "2"(n/4) : "d0", "memory"); return n; } @@ -233,7 +233,8 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n) " .long 5b,8b\n" ".previous" : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) - : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4)); + : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4) + : "memory"); return n; } @@ -514,7 +515,7 @@ __constant_copy_from_user(void *to, const void *from, unsigned long n) "13:" \ : "=a"(to), "=a"(from), "=d"(n) \ : "0"(to), "1"(from), "2"(n/4) \ - : "d0") + : "d0", "memory") static inline unsigned long __constant_copy_to_user(void *to, const void *from, unsigned long n) diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index 2ad5c196c..4180f3df7 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -193,6 +193,7 @@ #define __NR_sendfile 187 #define __NR_getpmsg 188 /* some people actually want streams */ #define __NR_putpmsg 189 /* some people actually want streams */ +#define __NR_vfork 190 /* user-visible error numbers are in the range -1 - -122: see */ @@ -323,49 +324,6 @@ static inline _syscall1(int,_exit,int,exitcode) static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) static inline _syscall1(int,delete_module,const char *,name) -/* - * 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) -{ - pid_t pid; - mm_segment_t fs; - - fs = get_fs(); - set_fs (KERNEL_DS); - - { - register long retval __asm__ ("d0"); - register long clone_arg __asm__ ("d1") = flags | CLONE_VM; - - __asm__ __volatile__ - ("clrl %%d2\n\t" - "trap #0\n\t" /* Linux/m68k system call */ - "tstl %0\n\t" /* child or parent */ - "jne 1f\n\t" /* parent - jump */ - "lea %%sp@(-8192),%6\n\t" /* reload current */ - "movel %3,%%sp@-\n\t" /* push argument */ - "jsr %4@\n\t" /* call fn */ - "movel %0,%%d1\n\t" /* pass exit value */ - "movel %2,%0\n\t" /* exit */ - "trap #0\n" - "1:" - : "=d" (retval) - : "0" (__NR_clone), "i" (__NR_exit), - "r" (arg), "a" (fn), "d" (clone_arg), "r" (current) - : "d0", "d2"); - pid = retval; - } - - set_fs (fs); - return pid; -} - static inline pid_t wait(int * wait_stat) { return waitpid(-1,wait_stat,0); diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h index 1e942b9e5..8162a4979 100644 --- a/include/asm-m68k/virtconvert.h +++ b/include/asm-m68k/virtconvert.h @@ -18,7 +18,7 @@ * Change virtual addresses to physical addresses and vv. */ extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const)); -extern unsigned long mm_vtop_fallback (unsigned long); +extern unsigned long mm_vtop_fallback (unsigned long) __attribute__ ((const)); extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const)); #ifdef CONFIG_SINGLE_MEMORY_CHUNK -- cgit v1.2.3