diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /include/asm-arm | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'include/asm-arm')
45 files changed, 851 insertions, 621 deletions
diff --git a/include/asm-arm/arch-arc/ide.h b/include/asm-arm/arch-arc/ide.h index 5729b956d..35c28427f 100644 --- a/include/asm-arm/arch-arc/ide.h +++ b/include/asm-arm/arch-arc/ide.h @@ -20,7 +20,7 @@ * 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_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; @@ -30,7 +30,7 @@ ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq) reg += 1; } hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; - hw->irq = *irq; + hw->irq = irq; } /* @@ -44,8 +44,7 @@ static __inline__ void ide_init_default_hwifs(void) memset(hw, 0, sizeof(*hw)); - ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL); - hw.irq = IRQ_HARDDISK; + ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_HARDDISK); ide_register_hw(&hw, NULL); #endif } diff --git a/include/asm-arm/arch-arc/system.h b/include/asm-arm/arch-arc/system.h index 9e2e99cfd..068c968cc 100644 --- a/include/asm-arm/arch-arc/system.h +++ b/include/asm-arm/arch-arc/system.h @@ -30,7 +30,7 @@ extern __inline__ void arch_reset(char mode) /* * Do any cleanups that the processor may require */ - processor._proc_fin(); + cpu_proc_fin(); /* * Reset all expansion cards. diff --git a/include/asm-arm/arch-arc/time.h b/include/asm-arm/arch-arc/time.h index c02ac8df5..5e7f3c863 100644 --- a/include/asm-arm/arch-arc/time.h +++ b/include/asm-arm/arch-arc/time.h @@ -167,6 +167,9 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); } static struct irqaction timerirq = { diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h index 5cad83502..afa7275b0 100644 --- a/include/asm-arm/arch-ebsa110/hardware.h +++ b/include/asm-arm/arch-ebsa110/hardware.h @@ -40,5 +40,7 @@ #define FLUSH_BASE 0xdf000000 #define PCIO_BASE 0xf0000000 +#define PARAMS_BASE (PAGE_OFFSET + 0x400) + #endif diff --git a/include/asm-arm/arch-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h index b23ee6863..462d6ba72 100644 --- a/include/asm-arm/arch-ebsa285/io.h +++ b/include/asm-arm/arch-ebsa285/io.h @@ -1,10 +1,11 @@ /* * linux/include/asm-arm/arch-ebsa285/io.h * - * Copyright (C) 1997,1998 Russell King + * Copyright (C) 1997-1999 Russell King * * Modifications: - * 06-Dec-1997 RMK Created. + * 06-12-1997 RMK Created. + * 07-04-1999 RMK Major cleanup */ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H @@ -18,132 +19,33 @@ #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 __pci_io_addr(x) (PCIO_BASE + (unsigned int)(x)) -#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 __inb(p) (*(volatile unsigned char *)__pci_io_addr(p)) +#define __inl(p) (*(volatile unsigned long *)__pci_io_addr(p)) -extern __inline__ unsigned int __ioaddr (unsigned int port) \ -{ \ - return (unsigned int)(PCIO_BASE + port); \ +extern __inline__ unsigned int __inw(unsigned int port) +{ + unsigned int value; + __asm__ __volatile__( + "ldr%?h %0, [%1, %2] @ inw" + : "=&r" (value) + : "r" (PCIO_BASE), "r" (port)); + return value; } -#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") +#define __outb(v,p) (*(volatile unsigned char *)__pci_io_addr(p) = (v)) +#define __outl(v,p) (*(volatile unsigned long *)__pci_io_addr(p) = (v)) -#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__( \ - "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 __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 __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)) +extern __inline__ void __outw(unsigned int value, unsigned int port) +{ + __asm__ __volatile__( + "str%?h %0, [%1, %2] @ outw" + : : "r" (value), "r" (PCIO_BASE), "r" (port)); +} -#define inl_t(p) \ - (*(volatile unsigned long *)(p)) +#define __ioaddr(p) __pci_io_addr(p) /* * ioremap support - validate a PCI memory address, @@ -151,7 +53,7 @@ DECLARE_IO(long,l,"","Jr") * address for the page tables. */ #define valid_ioaddr(iomem,size) ((iomem) < 0x80000000 && (iomem) + (size) <= 0x80000000) -#define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM) +#define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM) /* * Fudge up IO addresses by this much. Once we're confident that nobody @@ -160,6 +62,8 @@ DECLARE_IO(long,l,"","Jr") */ #define IO_FUDGE_FACTOR PCIMEM_BASE +#define __pci_mem_addr(x) ((void *)(IO_FUDGE_FACTOR + (unsigned long)(x))) + /* * ioremap takes a PCI memory address, as specified in * linux/Documentation/IO-mapping.txt @@ -176,30 +80,20 @@ DECLARE_IO(long,l,"","Jr") #define ioremap_nocache(iomem_addr,size) ioremap((iomem_addr),(size)) -extern void iounmap(void *addr); +#define iounmap(_addr) do { __iounmap(__pci_mem_addr((_addr))); } while (0) -#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; \ -} - -#define DECLARE_PCI_READ(typ,fnsuffix) \ -static inline unsigned typ read##fnsuffix (unsigned int addr) \ -{ \ - return *(volatile unsigned typ *)(IO_FUDGE_FACTOR + addr); \ -} +#define readb(addr) (*(volatile unsigned char *)__pci_mem_addr(addr)) +#define readw(addr) (*(volatile unsigned short *)__pci_mem_addr(addr)) +#define readl(addr) (*(volatile unsigned long *)__pci_mem_addr(addr)) -#define DECLARE_PCI(typ,fnsuffix) \ - DECLARE_PCI_WRITE(typ,fnsuffix) \ - DECLARE_PCI_READ(typ,fnsuffix) +#define writeb(b,addr) (*(volatile unsigned char *)__pci_mem_addr(addr) = (b)) +#define writew(b,addr) (*(volatile unsigned short *)__pci_mem_addr(addr) = (b)) +#define writel(b,addr) (*(volatile unsigned long *)__pci_mem_addr(addr) = (b)) -DECLARE_PCI(char,b) -DECLARE_PCI(short,w) -DECLARE_PCI(long,l) +#define memset_io(a,b,c) memset(__pci_mem_addr(a),(b),(c)) +#define memcpy_fromio(a,b,c) memcpy((a),__pci_mem_addr(b),(c)) +#define memcpy_toio(a,b,c) memcpy(__pci_mem_addr(a),(b),(c)) -#undef DECLARE_PCI -#undef DECLARE_PCI_READ -#undef DECLARE_PCI_WRITE +#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__pci_mem_addr(b),(c),(d)) #endif diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index ca1a55cdb..1c4bc42be 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -110,6 +110,8 @@ static void no_action(int cpl, void *dev_id, struct pt_regs *regs) } static struct irqaction irq_cascade = { no_action, 0, 0, "cascade", NULL, NULL }; +static struct resource pic1_resource = { "pic1", 0x20, 0x3f }; +static struct resource pic2_resource = { "pic2", 0xa0, 0xbf }; static __inline__ void irq_init_irq(void) { @@ -159,6 +161,8 @@ static __inline__ void irq_init_irq(void) if (isa_irq != -1) { /* * Setup, and then probe for an ISA PIC + * If the PIC is not there, then we + * ignore the PIC. */ outb(0x11, PIC_LO); outb(_ISA_IRQ(0), PIC_MASK_LO); /* IRQ number */ @@ -201,8 +205,8 @@ static __inline__ void irq_init_irq(void) irq_desc[irq].unmask = isa_unmask_pic_hi_irq; } - request_region(PIC_LO, 2, "pic1"); - request_region(PIC_HI, 2, "pic2"); + request_resource(&ioport_resource, &pic1_resource); + request_resource(&ioport_resource, &pic2_resource); setup_arm_irq(IRQ_ISA_CASCADE, &irq_cascade); setup_arm_irq(isa_irq, &irq_cascade); } diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h index 7c5cd89c4..91e3ae284 100644 --- a/include/asm-arm/arch-ebsa285/time.h +++ b/include/asm-arm/arch-ebsa285/time.h @@ -115,6 +115,9 @@ static void isa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); } static struct irqaction isa_timer_irq = { @@ -126,8 +129,7 @@ static struct irqaction isa_timer_irq = { NULL }; -__initfunc(static unsigned long -get_isa_cmos_time(void)) +static unsigned long __init get_isa_cmos_time(void) { unsigned int year, mon, day, hour, min, sec; int i; @@ -237,10 +239,8 @@ static void __ebsa285_text timer1_interrupt(int irq, void *dev_id, struct pt_reg { *CSR_TIMER1_CLR = 0; - /* Do the LEDs things on non-CATS hardware. - */ - if (!machine_is_cats()) - do_leds(); + /* Do the LEDs things */ + do_leds(); do_timer(regs); @@ -257,6 +257,9 @@ static void __ebsa285_text timer1_interrupt(int irq, void *dev_id, struct pt_reg else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); } static struct irqaction __ebsa285_data timer1_irq = { @@ -279,22 +282,20 @@ set_dummy_time(unsigned long secs) */ extern __inline__ void setup_timer(void) { - switch(machine_arch_type) { - case MACH_TYPE_CO285: + if (machine_arch_type == MACH_TYPE_CO285) /* * Add-in 21285s shouldn't access the RTC */ rtc_base = 0; - break; - - default: + else rtc_base = 0x70; - break; - } if (rtc_base) { int reg_d, reg_b; + /* + * Probe for the RTC. + */ reg_d = CMOS_READ(RTC_REG_D); /* @@ -314,7 +315,7 @@ extern __inline__ void setup_timer(void) CMOS_READ(RTC_REG_B) == reg_b) { /* - * Check the battery + * We have a RTC. Check the battery */ if ((reg_d & 0x80) == 0) printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n"); @@ -332,7 +333,6 @@ extern __inline__ void setup_timer(void) xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0); set_rtc_mmss = set_dummy_time; } - if (machine_is_ebsa285() || machine_is_co285()) { gettimeoffset = timer1_gettimeoffset; diff --git a/include/asm-arm/arch-rpc/system.h b/include/asm-arm/arch-rpc/system.h index bb220ced4..a4b92939e 100644 --- a/include/asm-arm/arch-rpc/system.h +++ b/include/asm-arm/arch-rpc/system.h @@ -17,7 +17,7 @@ "mcr p15, 0, %0, c1, c0, 0;" \ "movs pc, #0" \ : \ - : "r" (processor.u.armv3v4.reset())); \ + : "r" (cpu_reset())); \ } #endif diff --git a/include/asm-arm/arch-rpc/time.h b/include/asm-arm/arch-rpc/time.h index b28666b37..0ac40356a 100644 --- a/include/asm-arm/arch-rpc/time.h +++ b/include/asm-arm/arch-rpc/time.h @@ -151,7 +151,7 @@ extern __inline__ unsigned long get_rtc_time(void) */ 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]); @@ -175,6 +175,9 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); } static struct irqaction timerirq = { diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h index 431194234..92bcf6f8e 100644 --- a/include/asm-arm/atomic.h +++ b/include/asm-arm/atomic.h @@ -81,6 +81,19 @@ static __inline__ int atomic_dec_and_test(volatile atomic_t *v) return result; } +extern __inline__ int atomic_add_negative(int i, volatile atomic_t *v) +{ + unsigned long flags; + int result; + + save_flags_cli(flags); + v->counter += i; + result = (v->counter < 0); + restore_flags(flags); + + return result; +} + static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *addr) { unsigned long flags; diff --git a/include/asm-arm/bugs.h b/include/asm-arm/bugs.h index b9fc82775..637d89c1b 100644 --- a/include/asm-arm/bugs.h +++ b/include/asm-arm/bugs.h @@ -8,6 +8,6 @@ #include <asm/proc-fns.h> -#define check_bugs() processor._check_bugs() +#define check_bugs() cpu_check_bugs() #endif diff --git a/include/asm-arm/cache.h b/include/asm-arm/cache.h index 48a830351..d8f057be1 100644 --- a/include/asm-arm/cache.h +++ b/include/asm-arm/cache.h @@ -8,4 +8,12 @@ #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) #define SMP_CACHE_BYTES L1_CACHE_BYTES +#ifdef MODULE +#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) +#else +#define __cacheline_aligned \ + __attribute__((__aligned__(L1_CACHE_BYTES), \ + __section__(".data.cacheline_aligned"))) +#endif + #endif diff --git a/include/asm-arm/cpu-multi26.h b/include/asm-arm/cpu-multi26.h new file mode 100644 index 000000000..5f02bfc9c --- /dev/null +++ b/include/asm-arm/cpu-multi26.h @@ -0,0 +1,68 @@ +#ifndef __ASSEMBLY__ + +#include <asm/page.h> + +/* forward-declare task_struct */ +struct task_struct; + +/* + * Don't change this structure - ASM code + * relies on it. + */ +extern struct processor { + /* MISC + * get data abort address/flags + */ + void (*_data_abort)(unsigned long pc); + /* + * check for any bugs + */ + void (*_check_bugs)(void); + /* + * Set up any processor specifics + */ + void (*_proc_init)(void); + /* + * Disable any processor specifics + */ + void (*_proc_fin)(void); + /* + * Processor architecture specific + */ + /* MEMC + * + * remap memc tables + */ + void (*_remap_memc)(void *tsk); + /* + * update task's idea of mmap + */ + void (*_update_map)(void *tsk); + /* + * update task's idea after abort + */ + void (*_update_mmu_cache)(void *vma, unsigned long addr, pte_t pte); + /* XCHG + */ + unsigned long (*_xchg_1)(unsigned long x, volatile void *ptr); + unsigned long (*_xchg_2)(unsigned long x, volatile void *ptr); + unsigned long (*_xchg_4)(unsigned long x, volatile void *ptr); +} processor; + +extern const struct processor arm2_processor_functions; +extern const struct processor arm250_processor_functions; +extern const struct processor arm3_processor_functions; + +#define cpu_data_abort(pc) processor._data_abort(pc) +#define cpu_check_bugs() processor._check_bugs() +#define cpu_proc_init() processor._proc_init() +#define cpu_proc_fin() processor._proc_fin() + +#define cpu_remap_memc(tsk) processor._remap_memc(tsk) +#define cpu_update_map(tsk) processor._update_map(tsk) +#define cpu_update_mmu_cache(vma,addr,pte) processor._update_mmu_cache(vma,addr,pte) +#define cpu_xchg_1(x,ptr) processor._xchg_1(x,ptr) +#define cpu_xchg_2(x,ptr) processor._xchg_2(x,ptr) +#define cpu_xchg_4(x,ptr) processor._xchg_4(x,ptr) + +#endif diff --git a/include/asm-arm/cpu-multi32.h b/include/asm-arm/cpu-multi32.h new file mode 100644 index 000000000..ed80e894e --- /dev/null +++ b/include/asm-arm/cpu-multi32.h @@ -0,0 +1,117 @@ +#ifndef __ASSEMBLY__ + +#include <asm/page.h> + +/* forward-declare task_struct */ +struct task_struct; + +/* + * Don't change this structure - ASM code + * relies on it. + */ +extern struct processor { + /* MISC + * get data abort address/flags + */ + void (*_data_abort)(unsigned long pc); + /* + * check for any bugs + */ + void (*_check_bugs)(void); + /* + * Set up any processor specifics + */ + void (*_proc_init)(void); + /* + * Disable any processor specifics + */ + void (*_proc_fin)(void); + /* + * Processor architecture specific + */ + /* CACHE + * + * flush all caches + */ + void (*_flush_cache_all)(void); + /* + * flush a specific page or pages + */ + void (*_flush_cache_area)(unsigned long address, unsigned long end, int flags); + /* + * flush cache entry for an address + */ + void (*_flush_cache_entry)(unsigned long address); + /* + * clean a virtual address range from the + * D-cache without flushing the cache. + */ + void (*_clean_cache_area)(unsigned long start, unsigned long size); + /* + * flush a page to RAM + */ + void (*_flush_ram_page)(unsigned long page); + /* TLB + * + * flush all TLBs + */ + void (*_flush_tlb_all)(void); + /* + * flush a specific TLB + */ + void (*_flush_tlb_area)(unsigned long address, unsigned long end, int flags); + /* + * Set the page table + */ + void (*_set_pgd)(unsigned long pgd_phys); + /* + * Set a PMD (handling IMP bit 4) + */ + 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 size); + /* + * write back dirty cached data + */ + void (*_cache_wback_area)(unsigned long start, unsigned long end); + /* + * purge cached data without (necessarily) writing it back + */ + void (*_cache_purge_area)(unsigned long start, unsigned long end); +} processor; + +extern const struct processor arm6_processor_functions; +extern const struct processor arm7_processor_functions; +extern const struct processor sa110_processor_functions; + +#define cpu_data_abort(pc) processor._data_abort(pc) +#define cpu_check_bugs() processor._check_bugs() +#define cpu_proc_init() processor._proc_init() +#define cpu_proc_fin() processor._proc_fin() + +#define cpu_flush_cache_all() processor._flush_cache_all() +#define cpu_flush_cache_area(start,end,flags) processor._flush_cache_area(start,end,flags) +#define cpu_flush_cache_entry(addr) processor._flush_cache_entry(addr) +#define cpu_clean_cache_area(start,size) processor._clean_cache_area(start,size) +#define cpu_flush_ram_page(page) processor._flush_ram_page(page) +#define cpu_flush_tlb_all() processor._flush_tlb_all() +#define cpu_flush_tlb_area(start,end,flags) processor._flush_tlb_area(start,end,flags) +#define cpu_switch_mm(pgd,tsk) processor._set_pgd(pgd) +#define cpu_set_pmd(pmdp, pmd) processor._set_pmd(pmdp, pmd) +#define cpu_set_pte(ptep, pte) processor._set_pte(ptep, pte) +#define cpu_reset() processor.reset() +#define cpu_flush_icache_area(start,end) processor._flush_icache_area(start,end) +#define cpu_cache_wback_area(start,end) processor._cache_wback_area(start,end) +#define cpu_cache_purge_area(start,end) processor._cache_purge_area(start,end) + +#endif diff --git a/include/asm-arm/cpu-single.h b/include/asm-arm/cpu-single.h new file mode 100644 index 000000000..009dffb15 --- /dev/null +++ b/include/asm-arm/cpu-single.h @@ -0,0 +1,61 @@ +/* + * Single CPU + */ +#define __cpu_fn(name,x) cpu_##name##x +#define cpu_fn(name,x) __cpu_fn(name,x) + +/* + * If we are supporting multiple CPUs, then + * we must use a table of function pointers + * for this lot. Otherwise, we can optimise + * the table away. + */ +#define cpu_data_abort cpu_fn(CPU_NAME,_data_abort) +#define cpu_check_bugs cpu_fn(CPU_NAME,_check_bugs) +#define cpu_proc_init cpu_fn(CPU_NAME,_proc_init) +#define cpu_proc_fin cpu_fn(CPU_NAME,_proc_fin) + +#define cpu_flush_cache_all cpu_fn(CPU_NAME,_flush_cache_all) +#define cpu_flush_cache_area cpu_fn(CPU_NAME,_flush_cache_area) +#define cpu_flush_cache_entry cpu_fn(CPU_NAME,_flush_cache_entry) +#define cpu_clean_cache_area cpu_fn(CPU_NAME,_clean_cache_area) +#define cpu_flush_ram_page cpu_fn(CPU_NAME,_flush_ram_page) +#define cpu_flush_tlb_all cpu_fn(CPU_NAME,_flush_tlb_all) +#define cpu_flush_tlb_area cpu_fn(CPU_NAME,_flush_tlb_area) +#define cpu_switch_mm cpu_fn(CPU_NAME,_set_pgd) +#define cpu_set_pmd cpu_fn(CPU_NAME,_set_pmd) +#define cpu_set_pte cpu_fn(CPU_NAME,_set_pte) +#define cpu_reset cpu_fn(CPU_NAME,reset) +#define cpu_flush_icache_area cpu_fn(CPU_NAME,_flush_icache_area) +#define cpu_cache_wback_area cpu_fn(CPU_NAME,_cache_wback_area) +#define cpu_cache_purge_area cpu_fn(CPU_NAME,_cache_purge_area) + +#ifndef __ASSEMBLY__ + +#include <asm/page.h> + +/* forward declare task_struct */ +struct task_struct; + +/* declare all the functions as extern */ +extern void cpu_data_abort(unsigned long pc); +extern void cpu_check_bugs(void); +extern void cpu_proc_init(void); +extern void cpu_proc_fin(void); + +extern void cpu_flush_cache_all(void); +extern void cpu_flush_cache_area(unsigned long address, unsigned long end, int flags); +extern void cpu_flush_cache_entry(unsigned long address); +extern void cpu_clean_cache_area(unsigned long start, unsigned long size); +extern void cpu_flush_ram_page(unsigned long page); +extern void cpu_flush_tlb_all(void); +extern void cpu_flush_tlb_area(unsigned long address, unsigned long end, int flags); +extern void cpu_switch_mm(unsigned long pgd_phys, struct task_struct *tsk); +extern void cpu_set_pmd(pmd_t *pmdp, pmd_t pmd); +extern void cpu_set_pte(pte_t *ptep, pte_t pte); +extern unsigned long cpu_reset(void); +extern void cpu_flush_icache_area(unsigned long start, unsigned long size); +extern void cpu_cache_wback_area(unsigned long start, unsigned long end); +extern void cpu_cache_purge_area(unsigned long start, unsigned long end); + +#endif diff --git a/include/asm-arm/dec21285.h b/include/asm-arm/dec21285.h index e7bfa21c4..c86e2c851 100644 --- a/include/asm-arm/dec21285.h +++ b/include/asm-arm/dec21285.h @@ -28,6 +28,12 @@ #define CSR_PCICSRIOBASE DC21285_IO(0x0014) #define CSR_PCISDRAMBASE DC21285_IO(0x0018) #define CSR_PCIROMBASE DC21285_IO(0x0030) +#define CSR_MBOX0 DC21285_IO(0x0050) +#define CSR_MBOX1 DC21285_IO(0x0054) +#define CSR_MBOX2 DC21285_IO(0x0058) +#define CSR_MBOX3 DC21285_IO(0x005c) +#define CSR_DOORBELL DC21285_IO(0x0060) +#define CSR_DOORBELL_SETUP DC21285_IO(0x0064) #define CSR_ROMWRITEREG DC21285_IO(0x0068) #define CSR_CSRBASEMASK DC21285_IO(0x00f8) #define CSR_CSRBASEOFFSET DC21285_IO(0x00fc) diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h index bc7d03ddd..b67e33a9d 100644 --- a/include/asm-arm/dma.h +++ b/include/asm-arm/dma.h @@ -5,8 +5,8 @@ typedef unsigned int dmach_t; #include <linux/config.h> #include <linux/kernel.h> +#include <linux/spinlock.h> #include <asm/irq.h> -#include <asm/spinlock.h> #include <asm/arch/dma.h> /* @@ -135,7 +135,7 @@ extern int get_dma_residue(dmach_t channel); #define NO_DMA 255 #endif -#ifdef CONFIG_PCI_QUIRKS +#ifdef CONFIG_PCI extern int isa_dma_bridge_buggy; #else #define isa_dma_bridge_buggy (0) diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index 8b0980053..c25a02479 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h @@ -47,7 +47,8 @@ typedef struct { void *null; } elf_fpregset_t; /* This yields a mask that user programs can use to figure out what instruction set this cpu supports. */ -#define ELF_HWCAP (armidlist[armidindex].hwcap) +extern unsigned int elf_hwcap; +#define ELF_HWCAP (elf_hwcap) /* This yields a string that ld.so will use to load implementation specific libraries for optimization. This is more specific in diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h index 588c85894..79aec2cf6 100644 --- a/include/asm-arm/hardirq.h +++ b/include/asm-arm/hardirq.h @@ -1,7 +1,7 @@ #ifndef __ASM_HARDIRQ_H #define __ASM_HARDIRQ_H -#include <linux/tasks.h> +#include <linux/threads.h> extern unsigned int local_irq_count[NR_CPUS]; diff --git a/include/asm-arm/init.h b/include/asm-arm/init.h index 66ccbecd3..e364b5173 100644 --- a/include/asm-arm/init.h +++ b/include/asm-arm/init.h @@ -8,14 +8,10 @@ #ifdef CONFIG_TEXT_SECTIONS #define __init __attribute__ ((__section__ (".text.init"))) -#define __initfunc(__arginit) \ - __arginit __init; \ - __arginit #else #define __init -#define __initfunc(__arginit) __arginit #endif diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 35db8e667..5ee6dc4df 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -21,17 +21,7 @@ #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)) +extern void __iounmap(void *addr); #endif @@ -121,8 +111,12 @@ __IO(l,"",long) * This macro will give you the translated IO address for this particular * architecture, which can be used with the out_t... functions. */ +#ifdef __ioaddrc #define ioaddr(port) \ (__builtin_constant_p((port)) ? __ioaddrc((port)) : __ioaddr((port))) +#else +#define ioaddr(port) __ioaddr((port)) +#endif #ifndef ARCH_IO_DELAY /* @@ -205,6 +199,19 @@ __IO(l,"",long) #endif +#ifndef memcpy_fromio +/* + * 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 + /* * This isn't especially architecture dependent so it seems like it * might as well go here as anywhere. diff --git a/include/asm-arm/iomd.h b/include/asm-arm/iomd.h index 31be445da..87299be50 100644 --- a/include/asm-arm/iomd.h +++ b/include/asm-arm/iomd.h @@ -1,3 +1,4 @@ +#include <linux/config.h> #ifndef __ASSEMBLER__ #define __IOMD(offset) (IO_IOMD_BASE + (offset >> 2)) @@ -10,6 +11,10 @@ #define IOMD_KARTRX __IOMD(0x004) #define IOMD_KCTRL __IOMD(0x008) +#ifdef CONFIG_ARCH_CL7500 +#define IOMD_IOLINES __IOMD(0x00C) +#endif + #define IOMD_IRQSTATA __IOMD(0x010) #define IOMD_IRQREQA __IOMD(0x014) #define IOMD_IRQCLRA __IOMD(0x014) @@ -37,9 +42,23 @@ #define IOMD_T1GO __IOMD(0x058) #define IOMD_T1LATCH __IOMD(0x05c) +#ifdef CONFIG_ARCH_CL7500 +#define IOMD_IRQSTATC __IOMD(0x060) +#define IOMD_IRQREQC __IOMD(0x064) +#define IOMD_IRQMASKC __IOMD(0x068) + +#define IOMD_VIDMUX __IOMD(0x06c) + +#define IOMD_IRQSTATD __IOMD(0x070) +#define IOMD_IRQREQD __IOMD(0x074) +#define IOMD_IRQMASKD __IOMD(0x078) +#endif + #define IOMD_ROMCR0 __IOMD(0x080) #define IOMD_ROMCR1 __IOMD(0x084) +#ifdef CONFIG_ARCH_RPC #define IOMD_DRAMCR __IOMD(0x088) +#endif #define IOMD_VREFCR __IOMD(0x08C) #define IOMD_FSIZE __IOMD(0x090) @@ -47,14 +66,38 @@ #define IOMD_ID1 __IOMD(0x098) #define IOMD_VERSION __IOMD(0x09C) +#ifdef CONFIG_ARCH_RPC #define IOMD_MOUSEX __IOMD(0x0A0) #define IOMD_MOUSEY __IOMD(0x0A4) +#endif +#ifdef CONFIG_ARCH_CL7500 +#define IOMD_MSEDAT __IOMD(0x0A8) +#define IOMD_MSECTL __IOMD(0x0Ac) +#endif + +#ifdef CONFIG_ARCH_RPC #define IOMD_DMATCR __IOMD(0x0C0) +#endif #define IOMD_IOTCR __IOMD(0x0C4) #define IOMD_ECTCR __IOMD(0x0C8) +#ifdef CONFIG_ARCH_RPC #define IOMD_DMAEXT __IOMD(0x0CC) +#endif +#ifdef CONFIG_ARCH_CL7500 +#define IOMD_ASTCR __IOMD(0x0CC) +#define IOMD_DRAMCR __IOMD(0x0D0) +#define IOMD_SELFREF __IOMD(0x0D4) +#define IOMD_ATODICR __IOMD(0x0E0) +#define IOMD_ATODSR __IOMD(0x0E4) +#define IOMD_ATODCC __IOMD(0x0E8) +#define IOMD_ATODCNT1 __IOMD(0x0EC) +#define IOMD_ATODCNT2 __IOMD(0x0F0) +#define IOMD_ATODCNT3 __IOMD(0x0F4) +#define IOMD_ATODCNT4 __IOMD(0x0F8) +#endif +#ifdef CONFIG_ARCH_RPC #define DMA_EXT_IO0 1 #define DMA_EXT_IO1 2 #define DMA_EXT_IO2 4 @@ -87,6 +130,7 @@ #define IOMD_IO3ENDB __IOMD(0x16C) #define IOMD_IO3CR __IOMD(0x170) #define IOMD_IO3ST __IOMD(0x174) +#endif #define IOMD_SD0CURA __IOMD(0x180) #define IOMD_SD0ENDA __IOMD(0x184) @@ -95,12 +139,14 @@ #define IOMD_SD0CR __IOMD(0x190) #define IOMD_SD0ST __IOMD(0x194) +#ifdef CONFIG_ARCH_RPC #define IOMD_SD1CURA __IOMD(0x1A0) #define IOMD_SD1ENDA __IOMD(0x1A4) #define IOMD_SD1CURB __IOMD(0x1A8) #define IOMD_SD1ENDB __IOMD(0x1AC) #define IOMD_SD1CR __IOMD(0x1B0) #define IOMD_SD1ST __IOMD(0x1B4) +#endif #define IOMD_CURSCUR __IOMD(0x1C0) #define IOMD_CURSINIT __IOMD(0x1C4) diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h index f6e4c3e33..460d7b966 100644 --- a/include/asm-arm/mmu_context.h +++ b/include/asm-arm/mmu_context.h @@ -9,10 +9,30 @@ #ifndef __ASM_ARM_MMU_CONTEXT_H #define __ASM_ARM_MMU_CONTEXT_H -#define get_mmu_context(x) do { } while (0) +#include <asm/bitops.h> +#include <asm/pgtable.h> +#include <asm/arch/memory.h> +#include <asm/proc-fns.h> -#define init_new_context(mm) do { } while(0) -#define destroy_context(mm) do { } while(0) -#define activate_context(tsk) do { } while(0) +#define destroy_context(mm) do { } while(0) +#define init_new_context(tsk,mm) do { } while(0) + +/* + * This is the actual mm switch as far as the scheduler + * is concerned. No registers are touched. + */ +static inline void +switch_mm(struct mm_struct *prev, struct mm_struct *next, + struct task_struct *tsk, unsigned int cpu) +{ + if (prev != next) { + cpu_switch_mm(__virt_to_phys((unsigned long)next->pgd), tsk); + clear_bit(cpu, &prev->cpu_vm_mask); + } + set_bit(cpu, &next->cpu_vm_mask); +} + +#define activate_mm(prev, next) \ + switch_mm((prev),(next),NULL,smp_processor_id()) #endif diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 704b99b05..b047806fa 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h @@ -6,6 +6,19 @@ #ifdef __KERNEL__ +#ifndef __ASSEMBLY__ + +#define BUG() do { \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ + *(int *)0 = 0; \ +} while (0) + +#define PAGE_BUG(page) do { \ + BUG(); \ +} while (0) + +#endif /* __ASSEMBLY__ */ + #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) diff --git a/include/asm-arm/parport.h b/include/asm-arm/parport.h new file mode 100644 index 000000000..c08ee4686 --- /dev/null +++ b/include/asm-arm/parport.h @@ -0,0 +1,59 @@ +/* + * parport.h: ia32-specific parport initialisation + * + * Copyright (C) 1999 Tim Waugh <tim@cyberelk.demon.co.uk> + * + * This file should only be included by drivers/parport/parport_pc.c. + */ + +#ifndef _ASM_I386_PARPORT_H +#define _ASM_I386_PARPORT_H 1 + +#include <linux/config.h> + +/* Maximum number of ports to support. It is useless to set this greater + than PARPORT_MAX (in <linux/parport.h>). */ +#define PARPORT_PC_MAX_PORTS 8 + +/* If parport_cs (PCMCIA) is managing ports for us, we'll need the + * probing routines forever; otherwise we can lose them at boot time. */ +#ifdef CONFIG_PARPORT_PC_PCMCIA +#define __maybe_initdata +#define __maybe_init +#else +#define __maybe_initdata __initdata +#define __maybe_init __init +#endif + +static int __maybe_init parport_pc_init_pci(int irq, int dma); + +static int user_specified __maybe_initdata = 0; +int __init +parport_pc_init(int *io, int *io_hi, int *irq, int *dma) +{ + int count = 0, i = 0; + + if (io && *io) { + /* Only probe the ports we were given. */ + user_specified = 1; + do { + if (!*io_hi) *io_hi = 0x400 + *io; + if (parport_pc_probe_port(*(io++), *(io_hi++), + *(irq++), *(dma++))) + count++; + } while (*io && (++i < PARPORT_PC_MAX_PORTS)); + } else { + /* Probe all the likely ports. */ + if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0])) + count++; + if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0])) + count++; + if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0])) + count++; + count += parport_pc_init_pci (irq[0], dma[0]); + } + + return count; +} + +#endif /* !(_ASM_I386_PARPORT_H) */ diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index 084999561..993598dcb 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h @@ -13,4 +13,6 @@ extern int do_check_pgt_cache(int, int); #define PageSkip(page) (0) #define kern_addr_valid(addr) (1) +#define io_remap_page_range remap_page_range + #endif /* _ASMARM_PGTABLE_H */ diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h index 4cfd77955..087dcbcd0 100644 --- a/include/asm-arm/proc-armo/processor.h +++ b/include/asm-arm/proc-armo/processor.h @@ -10,6 +10,7 @@ * 28-09-1996 RMK Moved start_thread into the processor dependencies * 11-01-1998 RMK Added new uaccess_t * 09-09-1998 PJB Delete redundant `wp_works_ok' + * 30-05-1999 PJB Save sl across context switches */ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H @@ -26,11 +27,12 @@ struct context_save_struct { unsigned long r7; unsigned long r8; unsigned long r9; + unsigned long sl; unsigned long fp; unsigned long pc; }; -#define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, SVC26_MODE } +#define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, 0, SVC26_MODE } typedef struct { void (*put_byte)(void); /* Special calling convention */ @@ -77,6 +79,8 @@ extern uaccess_t uaccess_user, uaccess_kernel; extern unsigned long get_page_8k(int priority); extern void free_page_8k(unsigned long page); +#define THREAD_SIZE (8192) + #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)) diff --git a/include/asm-arm/proc-armo/system.h b/include/asm-arm/proc-armo/system.h index 733a6cdff..3d6ba7554 100644 --- a/include/asm-arm/proc-armo/system.h +++ b/include/asm-arm/proc-armo/system.h @@ -14,9 +14,9 @@ extern const char xchg_str[]; extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size) { switch (size) { - case 1: return processor.u.armv2._xchg_1(x, ptr); - case 2: return processor.u.armv2._xchg_2(x, ptr); - case 4: return processor.u.armv2._xchg_4(x, ptr); + case 1: return cpu_xchg_1(x, ptr); + case 2: return cpu_xchg_2(x, ptr); + case 4: return cpu_xchg_4(x, ptr); default: arm_invalidptr(xchg_str, size); } return 0; @@ -26,7 +26,7 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int * We need to turn the caches off before calling the reset vector - RiscOS * messes up if we don't */ -#define proc_hard_reset() processor._proc_fin() +#define proc_hard_reset() cpu_proc_fin() /* * This processor does not idle @@ -105,7 +105,7 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int " bic %0, %0, #0x0c000000\n" \ " orr %0, %0, %1\n" \ " teqp %0, #0\n" \ - : "=r" (temp) \ + : "=&r" (temp) \ : "r" (x) \ : "memory"); \ } while (0) diff --git a/include/asm-arm/proc-armv/domain.h b/include/asm-arm/proc-armv/domain.h new file mode 100644 index 000000000..398fdce5c --- /dev/null +++ b/include/asm-arm/proc-armv/domain.h @@ -0,0 +1,46 @@ +/* + * linux/include/asm-arm/proc-armv/domain.h + * + * Copyright (C) 1999 Russell King. + */ +#ifndef __ASM_PROC_DOMAIN_H +#define __ASM_PROC_DOMAIN_H + +/* + * Domain numbers + * + * DOMAIN_IO - domain 2 includes all IO only + * DOMAIN_KERNEL - domain 1 includes all kernel memory only + * DOMAIN_USER - domain 0 includes all user memory only + */ +#define DOMAIN_USER 0 +#define DOMAIN_KERNEL 1 +#define DOMAIN_TABLE 1 +#define DOMAIN_IO 2 + +/* + * Domain types + */ +#define DOMAIN_NOACCESS 0 +#define DOMAIN_CLIENT 1 +#define DOMAIN_MANAGER 3 + +#define domain_val(dom,type) ((type) << 2*(dom)) + +#define set_domain(x) \ + do { \ + __asm__ __volatile__( \ + "mcr p15, 0, %0, c3, c0 @ set domain" \ + : : "r" (x)); \ + } while (0) + +#define modify_domain(dom,type) \ + do { \ + unsigned int domain = current->thread.domain; \ + domain &= ~domain_val(dom, DOMAIN_MANAGER); \ + domain |= domain_val(dom, type); \ + current->thread.domain = domain; \ + set_domain(current->thread.domain); \ + } while (0) + +#endif diff --git a/include/asm-arm/proc-armv/io.h b/include/asm-arm/proc-armv/io.h index 8afecd2a5..72f0593ef 100644 --- a/include/asm-arm/proc-armv/io.h +++ b/include/asm-arm/proc-armv/io.h @@ -22,14 +22,14 @@ #include <asm/proc-fns.h> -#define dma_cache_inv(start, size) \ - do { processor.u.armv3v4._cache_purge_area((unsigned long)(start), \ +#define dma_cache_inv(start, size) \ + do { cpu_cache_purge_area((unsigned long)(start), \ ((unsigned long)(start)+(size))); } while (0) -#define dma_cache_wback(start, size) \ - do { processor.u.armv3v4._cache_wback_area((unsigned long)(start), \ +#define dma_cache_wback(start, size) \ + do { cpu_cache_wback_area((unsigned long)(start), \ ((unsigned long)(start)+(size))); } while (0) -#define dma_cache_wback_inv(start, size) \ - do { processor.u.armv3v4._flush_cache_area((unsigned long)(start), \ +#define dma_cache_wback_inv(start, size) \ + do { cpu_flush_cache_area((unsigned long)(start), \ ((unsigned long)(start)+(size)), 0); } while (0) diff --git a/include/asm-arm/proc-armv/pgtable.h b/include/asm-arm/proc-armv/pgtable.h index 8447519c9..f6bf55889 100644 --- a/include/asm-arm/proc-armv/pgtable.h +++ b/include/asm-arm/proc-armv/pgtable.h @@ -19,27 +19,26 @@ * Cache flushing... */ #define flush_cache_all() \ - processor.u.armv3v4._flush_cache_all() + cpu_flush_cache_all() #define flush_cache_mm(_mm) \ do { \ if ((_mm) == current->mm) \ - processor.u.armv3v4._flush_cache_all(); \ + cpu_flush_cache_all(); \ } while (0) #define flush_cache_range(_mm,_start,_end) \ do { \ if ((_mm) == current->mm) \ - processor.u.armv3v4._flush_cache_area \ - ((_start), (_end), 1); \ + cpu_flush_cache_area((_start), (_end), 1); \ } while (0) #define flush_cache_page(_vma,_vmaddr) \ do { \ if ((_vma)->vm_mm == current->mm) \ - processor.u.armv3v4._flush_cache_area \ - ((_vmaddr), (_vmaddr) + PAGE_SIZE, \ - ((_vma)->vm_flags & VM_EXEC) ? 1 : 0); \ + cpu_flush_cache_area((_vmaddr), \ + (_vmaddr) + PAGE_SIZE, \ + ((_vma)->vm_flags & VM_EXEC) ? 1 : 0); \ } while (0) #define clean_cache_range(_start,_end) \ @@ -47,18 +46,18 @@ unsigned long _s, _sz; \ _s = (unsigned long)_start; \ _sz = (unsigned long)_end - _s; \ - processor.u.armv3v4._clean_cache_area(_s, _sz); \ + cpu_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); \ + cpu_clean_cache_area(_s, _size); \ } while (0) #define flush_icache_range(_start,_end) \ - processor.u.armv3v4._flush_icache_area((_start), (_end) - (_start)) + cpu_flush_icache_area((_start), (_end) - (_start)) /* * We don't have a MEMC chip... @@ -73,7 +72,7 @@ * in the cache for this page. Is it necessary to invalidate the I-cache? */ #define flush_page_to_ram(_page) \ - processor.u.armv3v4._flush_ram_page ((_page) & PAGE_MASK); + cpu_flush_ram_page((_page) & PAGE_MASK); /* * TLB flushing: @@ -92,26 +91,24 @@ #define flush_tlb() flush_tlb_all() #define flush_tlb_all() \ - processor.u.armv3v4._flush_tlb_all() + cpu_flush_tlb_all() #define flush_tlb_mm(_mm) \ do { \ if ((_mm) == current->mm) \ - processor.u.armv3v4._flush_tlb_all(); \ + cpu_flush_tlb_all(); \ } while (0) #define flush_tlb_range(_mm,_start,_end) \ do { \ if ((_mm) == current->mm) \ - processor.u.armv3v4._flush_tlb_area \ - ((_start), (_end), 1); \ + cpu_flush_tlb_area((_start), (_end), 1); \ } while (0) #define flush_tlb_page(_vma,_vmaddr) \ do { \ if ((_vma)->vm_mm == current->mm) \ - processor.u.armv3v4._flush_tlb_area \ - ((_vmaddr), (_vmaddr) + PAGE_SIZE, \ + cpu_flush_tlb_area((_vmaddr), (_vmaddr) + PAGE_SIZE, \ ((_vma)->vm_flags & VM_EXEC) ? 1 : 0); \ } while (0) @@ -220,25 +217,6 @@ do { \ } while (0) -/* - * 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) - */ -#define pgd_none(pgd) (0) -#define pgd_bad(pgd) (0) -#define pgd_present(pgd) (1) -#define pgd_clear(pgdp) - -/* to find an entry in a kernel page-table-directory */ -#define pgd_offset_k(address) pgd_offset(&init_mm, address) - -/* 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); -} - extern unsigned long get_page_2k(int priority); extern void free_page_2k(unsigned long page); @@ -263,55 +241,6 @@ extern struct pgtable_cache_struct { #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) -{ - 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__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_pages((unsigned long) pgd, 2); -} - -#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) -{ - 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]; - /**************** * PMD functions * ****************/ @@ -336,7 +265,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; #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) +#define set_pmd(pmdp,pmd) cpu_set_pmd(pmdp,pmd) /* Find an entry in the second-level page table.. */ #define pmd_offset(dir, address) ((pmd_t *)(dir)) @@ -406,7 +335,6 @@ extern __inline__ unsigned long pmd_page(pmd_t pmd) return __phys_to_virt(ptr); } - /**************** * PTE functions * ****************/ @@ -443,7 +371,7 @@ extern __inline__ pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) return pte; } -#define set_pte(ptep, pte) processor.u.armv3v4._set_pte(ptep,pte) +#define set_pte(ptep, pte) cpu_set_pte(ptep,pte) extern __inline__ unsigned long pte_page(pte_t pte) { @@ -552,8 +480,6 @@ extern __inline__ void free_pte_slow(pte_t *pte) #define __S110 PAGE_SHARED #define __S111 PAGE_SHARED - - #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) /* @@ -569,12 +495,12 @@ extern __inline__ void free_pte_slow(pte_t *pte) #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_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_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); @@ -630,6 +556,100 @@ extern __inline__ pte_t * pte_alloc(pmd_t * pmd, unsigned long address) return (pte_t *) pmd_page(*pmd) + address; } +/* + * 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) + */ +#define pgd_none(pgd) (0) +#define pgd_bad(pgd) (0) +#define pgd_present(pgd) (1) +#define pgd_clear(pgdp) + +/* to find an entry in a kernel page-table-directory */ +#define pgd_offset_k(address) pgd_offset(&init_mm, address) + +/* used for quicklists */ +#define __pgd_next(pgd) (((unsigned long *)pgd)[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); +} + +extern pgd_t *get_pgd_slow(void); + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)__pgd_next(ret); + ret[1] = ret[2]; + clean_cache_area(ret + 1, 4); + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + __pgd_next(pgd) = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + do { + if (pgd) { /* can pgd be NULL? */ + pmd_t *pmd; + pte_t *pte; + + /* pgd is never none and bad - it is + * detected in the pmd macros. + */ + pmd = pmd_offset(pgd, 0); + if (pmd_none(*pmd)) + break; + if (pmd_bad(*pmd)) { + printk("free_pgd_slow: bad directory entry %08lx\n", pmd_val(*pmd)); + pmd_clear(pmd); + break; + } + + pte = pte_offset(pmd, 0); + pmd_clear(pmd); + pte_free(pte); + pmd_free(pmd); + } + } while (0); + free_pages((unsigned long) pgd, 2); +} + +#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) +{ + 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 *)__pgd_next(pgd)) + pgd[address >> PGDIR_SHIFT] = entry; +} + +extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; + #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 7186039f9..45af61ea7 100644 --- a/include/asm-arm/proc-armv/processor.h +++ b/include/asm-arm/proc-armv/processor.h @@ -1,17 +1,21 @@ /* * linux/include/asm-arm/proc-armv/processor.h * - * Copyright (c) 1996 Russell King. + * Copyright (c) 1996-1999 Russell King. * * Changelog: * 20-09-1996 RMK Created * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*' * 28-09-1996 RMK Moved start_thread into the processor dependencies * 09-09-1998 PJB Delete redundant `wp_works_ok' + * 30-05-1999 PJB Save sl across context switches + * 31-07-1999 RMK Added 'domain' stuff */ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H +#include <asm/proc/domain.h> + #define KERNEL_STACK_SIZE PAGE_SIZE struct context_save_struct { @@ -22,14 +26,21 @@ struct context_save_struct { unsigned long r7; unsigned long r8; unsigned long r9; + unsigned long sl; unsigned long fp; unsigned long pc; }; -#define INIT_CSS (struct context_save_struct){ SVC_MODE, 0, 0, 0, 0, 0, 0, 0, 0 } +#define INIT_CSS (struct context_save_struct){ SVC_MODE, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +#define EXTRA_THREAD_STRUCT \ + unsigned int domain; + +#define EXTRA_THREAD_STRUCT_INIT \ + , domain_val(DOMAIN_USER, DOMAIN_CLIENT) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT) -#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) \ @@ -52,6 +63,7 @@ struct context_save_struct { /* * NOTE! The task struct and the stack go together */ +#define THREAD_SIZE (PAGE_SIZE * 2) #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) diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index 2aa59a26e..20250f659 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -116,7 +116,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ " bic %0, %0, #192\n" \ " orr %0, %0, %1\n" \ " msr cpsr, %0" \ - : "=r" (temp) \ + : "=&r" (temp) \ : "r" (x) \ : "memory"); \ } while (0) diff --git a/include/asm-arm/proc-armv/uaccess.h b/include/asm-arm/proc-armv/uaccess.h index a015a0738..7bef26d38 100644 --- a/include/asm-arm/proc-armv/uaccess.h +++ b/include/asm-arm/proc-armv/uaccess.h @@ -2,36 +2,8 @@ * linux/include/asm-arm/proc-armv/uaccess.h */ -/* - * The fs functions are implemented on the ARMV3 and V4 architectures - * using the domain register. - * - * DOMAIN_IO - domain 2 includes all IO only - * DOMAIN_KERNEL - domain 1 includes all kernel memory only - * DOMAIN_USER - domain 0 includes all user memory only - */ - #include <asm/hardware.h> - -#define DOMAIN_CLIENT 1 -#define DOMAIN_MANAGER 3 - -#define DOMAIN_USER_CLIENT ((DOMAIN_CLIENT) << 0) -#define DOMAIN_USER_MANAGER ((DOMAIN_MANAGER) << 0) - -#define DOMAIN_KERNEL_CLIENT ((DOMAIN_CLIENT) << 2) -#define DOMAIN_KERNEL_MANAGER ((DOMAIN_MANAGER) << 2) - -#define DOMAIN_IO_CLIENT ((DOMAIN_CLIENT) << 4) -#define DOMAIN_IO_MANAGER ((DOMAIN_MANAGER) << 4) - -/* - * When we want to access kernel memory in the *_user functions, - * we change the domain register to KERNEL_DS, thus allowing - * unrestricted access - */ -#define KERNEL_DOMAIN (DOMAIN_USER_CLIENT | DOMAIN_KERNEL_MANAGER | DOMAIN_IO_CLIENT) -#define USER_DOMAIN (DOMAIN_USER_CLIENT | DOMAIN_KERNEL_CLIENT | DOMAIN_IO_CLIENT) +#include <asm/proc/domain.h> /* * Note that this is actually 0x1,0000,0000 @@ -48,8 +20,7 @@ extern __inline__ void set_fs (mm_segment_t fs) { current->addr_limit = fs; - __asm__ __volatile__("mcr p15, 0, %0, c3, c0" : - : "r" (fs ? USER_DOMAIN : KERNEL_DOMAIN)); + modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER); } /* We use 33-bit arithmetic here... */ diff --git a/include/asm-arm/proc-fns.h b/include/asm-arm/proc-fns.h index 75e976244..8970cf137 100644 --- a/include/asm-arm/proc-fns.h +++ b/include/asm-arm/proc-fns.h @@ -1,127 +1,61 @@ /* * linux/include/asm-arm/proc-fns.h * - * Copyright (C) 1997 Russell King + * Copyright (C) 1997-1999 Russell King */ #ifndef __ASM_PROCFNS_H #define __ASM_PROCFNS_H -#include <asm/page.h> - #ifdef __KERNEL__ -/* forward-declare task_struct */ -struct task_struct; +#include <linux/config.h> /* - * Don't change this structure + * Work out if we need multiple CPU support */ -extern struct processor { - const char *name; - /* MISC - * - * flush caches for task switch - */ - struct task_struct *(*_switch_to)(struct task_struct *prev, struct task_struct *next); - /* - * get data abort address/flags - */ - void (*_data_abort)(unsigned long pc); - /* - * check for any bugs - */ - void (*_check_bugs)(void); - /* - * Set up any processor specifics - */ - void (*_proc_init)(void); - /* - * Disable any processor specifics - */ - void (*_proc_fin)(void); - /* - * Processor architecture specific - */ - union { - struct { - /* CACHE - * - * flush all caches - */ - void (*_flush_cache_all)(void); - /* - * flush a specific page or pages - */ - void (*_flush_cache_area)(unsigned long address, unsigned long end, int flags); - /* - * flush cache entry for an address - */ - void (*_flush_cache_entry)(unsigned long address); - /* - * clean a virtual address range from the - * D-cache without flushing the cache. - */ - void (*_clean_cache_area)(unsigned long start, unsigned long size); - /* - * flush a page to RAM - */ - void (*_flush_ram_page)(unsigned long page); - /* TLB - * - * flush all TLBs - */ - void (*_flush_tlb_all)(void); - /* - * flush a specific TLB - */ - void (*_flush_tlb_area)(unsigned long address, unsigned long end, int flags); - /* - * Set a PMD (handling IMP bit 4) - */ - 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 size); - /* - * write back dirty cached data - */ - void (*_cache_wback_area)(unsigned long start, unsigned long end); - /* - * purge cached data without (necessarily) writing it back - */ - void (*_cache_purge_area)(unsigned long start, unsigned long end); - } armv3v4; - struct { - /* MEMC - * - * remap memc tables - */ - void (*_remap_memc)(void *tsk); - /* - * update task's idea of mmap - */ - void (*_update_map)(void *tsk); - /* - * update task's idea after abort - */ - void (*_update_mmu_cache)(void *vma, unsigned long addr, pte_t pte); - /* XCHG - */ - unsigned long (*_xchg_1)(unsigned long x, volatile void *ptr); - unsigned long (*_xchg_2)(unsigned long x, volatile void *ptr); - unsigned long (*_xchg_4)(unsigned long x, volatile void *ptr); - } armv2; - } u; -} processor; -#endif +#undef MULTI_CPU +#undef CPU_NAME + +#ifdef CONFIG_CPU_26 +# define CPU_INCLUDE_NAME "asm/cpu-multi26.h" +# define MULTI_CPU +#endif + +#ifdef CONFIG_CPU_32 +# define CPU_INCLUDE_NAME "asm/cpu-multi32.h" +# ifdef CONFIG_CPU_ARM6 +# ifdef CPU_NAME +# undef MULTI_CPU +# define MULTI_CPU +# else +# define CPU_NAME arm6 +# endif +# endif +# ifdef CONFIG_CPU_ARM7 +# ifdef CPU_NAME +# undef MULTI_CPU +# define MULTI_CPU +# else +# define CPU_NAME arm7 +# endif +# endif +# ifdef CONFIG_CPU_SA110 +# ifdef CPU_NAME +# undef MULTI_CPU +# define MULTI_CPU +# else +# define CPU_NAME sa110 +# endif +# endif #endif +#ifndef MULTI_CPU +#undef CPU_INCLUDE_NAME +#define CPU_INCLUDE_NAME "asm/cpu-single.h" +#endif + +#include CPU_INCLUDE_NAME + +#endif /* __KERNEL__ */ + +#endif /* __ASM_PROCFNS_H */ diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index 97141aa25..c0903f5e8 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -40,28 +40,38 @@ typedef unsigned long mm_segment_t; /* domain register */ #include <asm/arch/processor.h> #include <asm/proc/processor.h> +struct debug_info { + int nsaved; + struct { + unsigned long address; + unsigned long insn; + } bp[2]; +}; + 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 */ + /* fault info */ + unsigned long address; + unsigned long trap_no; + unsigned long error_code; + /* floating point */ + union fp_state fpstate; + /* debugging */ + struct debug_info debug; + /* context info */ + struct context_save_struct *save; 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 { \ +#define INIT_THREAD { \ 0, \ 0, \ 0, \ { { { 0, }, }, }, \ { 0, }, \ - (struct context_save_struct *)0, \ - SWAPPER_PG_DIR \ + (struct context_save_struct *)0 \ EXTRA_THREAD_STRUCT_INIT \ } @@ -94,7 +104,7 @@ struct mm_struct; extern void release_thread(struct task_struct *); /* Copy and release all segment info associated with a VM */ -#define copy_segments(nr, tsk, mm) do { } while (0) +#define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) #define forget_segments() do { } while (0) @@ -104,6 +114,11 @@ extern void free_task_struct(struct task_struct *); #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) +/* + * Create a new kernel thread + */ +extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); + #endif #endif /* __ASM_ARM_PROCESSOR_H */ diff --git a/include/asm-arm/procinfo.h b/include/asm-arm/procinfo.h index a89b7509f..8c11dfd80 100644 --- a/include/asm-arm/procinfo.h +++ b/include/asm-arm/procinfo.h @@ -1,34 +1,45 @@ /* * linux/include/asm-arm/procinfo.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996-1999 Russell King */ - #ifndef __ASM_PROCINFO_H #define __ASM_PROCINFO_H -#include <asm/proc-fns.h> - #ifndef __ASSEMBLER__ -#define HWCAP_SWP (1 << 0) -#define HWCAP_HALF (1 << 1) - -struct armversions { - const unsigned long id; /* Processor ID */ - const unsigned long mask; /* Processor ID mask */ - const char *manu; /* Manufacturer */ - const char *name; /* Processor name */ - const char *arch_vsn; /* Architecture version */ - const char *elf_vsn; /* ELF library version */ - const int hwcap; /* ELF HWCAP */ - const struct processor *proc; /* Processor-specific ASM */ +#include <asm/proc-fns.h> + +struct proc_info_item { + const char *manufacturer; + const char *cpu_name; }; -extern const struct armversions armidlist[]; -extern int armidindex; +/* + * Note! struct processor is always defined if we're + * using MULTI_CPU, otherwise this entry is unused, + * but still exists. + */ +struct proc_info_list { + unsigned int cpu_val; + unsigned int cpu_mask; + const char *arch_name; + const char *elf_name; + unsigned int elf_hwcap; + struct proc_info_item *info; +#ifdef MULTI_CPU + struct processor *proc; +#else + void *unused; +#endif +}; #endif +#define HWCAP_SWP 1 +#define HWCAP_HALF 2 +#define HWCAP_THUMB 4 +#define HWCAP_26BIT 8 /* Play it safe */ + #endif diff --git a/include/asm-arm/resource.h b/include/asm-arm/resource.h index 85d281157..b5c6ccc6f 100644 --- a/include/asm-arm/resource.h +++ b/include/asm-arm/resource.h @@ -28,8 +28,8 @@ { _STK_LIM, _STK_LIM }, \ { 0, LONG_MAX }, \ { LONG_MAX, LONG_MAX }, \ - { MAX_TASKS_PER_USER, MAX_TASKS_PER_USER }, \ - { NR_OPEN, NR_OPEN }, \ + { 0, 0 }, \ + { INR_OPEN, INR_OPEN }, \ { LONG_MAX, LONG_MAX }, \ { LONG_MAX, LONG_MAX }, \ } diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h index 111e24f96..71509e9e8 100644 --- a/include/asm-arm/semaphore.h +++ b/include/asm-arm/semaphore.h @@ -6,11 +6,12 @@ #include <linux/linkage.h> #include <asm/atomic.h> +#include <linux/spinlock.h> #include <linux/wait.h> struct semaphore { atomic_t count; - int waking; + int sleepers; wait_queue_head_t wait; }; @@ -30,7 +31,7 @@ struct semaphore { #define sema_init(sem, val) \ do { \ atomic_set(&((sem)->count), (val)); \ - (sem)->waking = 0; \ + (sem)->sleepers = 0; \ init_waitqueue_head(&(sem)->wait); \ } while (0) @@ -46,7 +47,7 @@ static inline void init_MUTEX_LOCKED(struct semaphore *sem) 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 int __down_trylock_failed(void /* params in registers */); asmlinkage void __up_wakeup (void /* special register calling convention */); extern void __down(struct semaphore * sem); diff --git a/include/asm-arm/smplock.h b/include/asm-arm/smplock.h index e62326a10..1590fafe9 100644 --- a/include/asm-arm/smplock.h +++ b/include/asm-arm/smplock.h @@ -4,7 +4,7 @@ * Default SMP lock implementation */ #include <linux/interrupt.h> -#include <asm/spinlock.h> +#include <linux/spinlock.h> extern spinlock_t kernel_flag; diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h index 74022ebae..e92e81deb 100644 --- a/include/asm-arm/spinlock.h +++ b/include/asm-arm/spinlock.h @@ -1,116 +1,6 @@ #ifndef __ASM_SPINLOCK_H #define __ASM_SPINLOCK_H -/* - * To be safe, we assume the only compiler that can cope with - * empty initialisers is EGCS. - */ -#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 90)) -#define EMPTY_STRUCT struct { } -#define EMPTY_STRUCT_INIT(t) (t) { } -#else -#define EMPTY_STRUCT unsigned char -#define EMPTY_STRUCT_INIT(t) (t) 0 -#endif +#error ARM architecture does not support SMP spin locks -/* - * These are the generic versions of the spinlocks - * and read-write locks.. We should actually do a - * <linux/spinlock.h> with all of this. Oh, well. - */ -#define spin_lock_irqsave(lock, flags) do { local_irq_save(flags); spin_lock(lock); } while (0) -#define spin_lock_irq(lock) do { local_irq_disable(); spin_lock(lock); } while (0) -#define spin_lock_bh(lock) do { local_bh_disable(); spin_lock(lock); } while (0) - -#define read_lock_irqsave(lock, flags) do { local_irq_save(flags); read_lock(lock); } while (0) -#define read_lock_irq(lock) do { local_irq_disable(); read_lock(lock); } while (0) -#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0) - -#define write_lock_irqsave(lock, flags) do { local_irq_save(flags); write_lock(lock); } while (0) -#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0) -#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0) - -#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0) -#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0) -#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0) - -#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0) -#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0) -#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0) - -#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0) -#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0) -#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0) - -#ifndef __SMP__ - -#define DEBUG_SPINLOCKS 0 /* 0 == no debugging, 1 == maintain lock state, 2 == full debugging */ - -#if (DEBUG_SPINLOCKS < 1) -/* - * Your basic spinlocks, allowing only a single CPU anywhere - */ -typedef EMPTY_STRUCT spinlock_t; -#define SPIN_LOCK_UNLOCKED EMPTY_STRUCT_INIT(spinlock_t) - -#define spin_lock_init(lock) do { } while(0) -#define spin_lock(lock) do { } while(0) -#define spin_trylock(lock) (1) -#define spin_unlock_wait(lock) do { } while(0) -#define spin_unlock(lock) do { } while(0) - -#elif (DEBUG_SPINLOCKS < 2) - -typedef struct { - volatile unsigned int lock; -} spinlock_t; -#define SPIN_LOCK_UNLOCKED (pinlock_t) { 0 } - -#define spin_lock_init(x) do { (x)->lock = 0; } while (0) -#define spin_lock(x) do { (x)->lock = 1; } while (0) -#define spin_trylock(lock) (!test_and_set_bit(0,(lock))) -#define spin_unlock_wait(x) do { } while (0) -#define spin_unlock(x) do { (x)->lock = 0; } while (0) - -#else /* (DEBUG_SPINLOCKS >= 2) */ - -typedef struct { - volatule unsigned int lock; - volatile unsigned int babble; - const char *module; -} spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ } - -#include <linux/kernel.h> - -#define spin_lock_init(x) do { (x)->lock = 0; } while (0) -#define spin_trylock(lock) (!test_and_set_bit(0,(lock))) - -#define spin_lock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_lock(%s:%p) already locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 1; restore_flags(__spinflags);} while (0) -#define spin_unlock_wait(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock_wait(%s:%p) deadlock\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} restore_flags(__spinflags);} while (0) -#define spin_unlock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if (!(x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock(%s:%p) not locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 0; restore_flags(__spinflags);} while (0) - -#endif - -/* - * Read-write spinlocks, allowing multiple readers - * but only one writer. - * - * NOTE! it is quite common to have readers in interrupts - * but no interrupt writers. For those circumstances we - * can "mix" irq-safe locks - any writer needs to get a - * irq-safe write-lock, but readers can get non-irqsafe - * read-locks. - */ -typedef EMPTY_STRUCT rwlock_t; -#define RW_LOCK_UNLOCKED EMPTY_STRUCT_INIT(rwlock_t) - -#define read_lock(lock) do { } while(0) -#define read_unlock(lock) do { } while(0) -#define write_lock(lock) do { } while(0) -#define write_unlock(lock) do { } while(0) - -#else -#error ARM architecture does not support spin locks -#endif /* SMP */ #endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-arm/string.h b/include/asm-arm/string.h index d185c87bb..9c72b0173 100644 --- a/include/asm-arm/string.h +++ b/include/asm-arm/string.h @@ -14,6 +14,7 @@ extern char * strchr(const char * s, int c); #define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMSET +#define __HAVE_ARCH_MEMCHR #define __HAVE_ARCH_MEMZERO extern void memzero(void *ptr, int n); diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 80252899d..b4f4d4136 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -32,6 +32,7 @@ extern unsigned int __machine_arch_type; #define MACH_TYPE_CLPS7110 9 #define MACH_TYPE_ARCHIMEDES 10 #define MACH_TYPE_A5K 11 +#define MACH_TYPE_SA1100 12 /* not allocated!!! */ /* * Sort out a definition for machine_arch_type @@ -140,15 +141,19 @@ extern asmlinkage void __backtrace(void); #define wmb() mb() #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); +#define prepare_to_switch() do { } while(0) + /* * switch_to(prev, next) should switch from task `prev' to `next' * `prev' will never be the same as `next'. * The `mb' is to tell GCC not to cache `current' across this call. */ -#define switch_to(prev,next,last) \ - do { \ - last = processor._switch_to(prev,next); \ - mb(); \ +extern struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next); + +#define switch_to(prev,next,last) \ + do { \ + last = __switch_to(prev,next); \ + mb(); \ } while (0) #endif diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h index 5e05c1754..df8a343b0 100644 --- a/include/asm-arm/termios.h +++ b/include/asm-arm/termios.h @@ -43,6 +43,8 @@ struct termio { #define TIOCM_DSR 0x100 #define TIOCM_CD TIOCM_CAR #define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ @@ -60,6 +62,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-arm/unistd.h b/include/asm-arm/unistd.h index f4a7ed33a..9a436259d 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -306,39 +306,39 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ #ifdef __KERNEL_SYSCALLS__ -static inline int idle(void) +static inline long idle(void) { - extern int sys_idle(void); + extern long sys_idle(void); return sys_idle(); } -static inline int pause(void) +static inline long pause(void) { - extern int sys_pause(void); + extern long sys_pause(void); return sys_pause(); } -static inline int sync(void) +static inline long sync(void) { - extern int sys_sync(void); + extern long sys_sync(void); return sys_sync(); } static inline pid_t setsid(void) { - extern int sys_setsid(void); + extern long sys_setsid(void); return sys_setsid(); } -static inline int write(int fd, const char *buf, off_t count) +static inline long write(int fd, const char *buf, off_t count) { - extern int sys_write(int, const char *, int); + extern long sys_write(int, const char *, int); return sys_write(fd, buf, count); } -static inline int read(int fd, char *buf, off_t count) +static inline long read(int fd, char *buf, off_t count) { - extern int sys_read(int, char *, int); + extern long sys_read(int, char *, int); return sys_read(fd, buf, count); } @@ -348,44 +348,44 @@ static inline off_t lseek(int fd, off_t offset, int count) return sys_lseek(fd, offset, count); } -static inline int dup(int fd) +static inline long dup(int fd) { - extern int sys_dup(int); + extern long sys_dup(int); return sys_dup(fd); } -static inline int open(const char *file, int flag, int mode) +static inline long open(const char *file, int flag, int mode) { - extern int sys_open(const char *, int, int); + extern long sys_open(const char *, int, int); return sys_open(file, flag, mode); } -static inline int close(int fd) +static inline long close(int fd) { return sys_close(fd); } -static inline int _exit(int exitcode) +static inline long _exit(int exitcode) { - extern int sys_exit(int) __attribute__((noreturn)); + extern long sys_exit(int) __attribute__((noreturn)); return sys_exit(exitcode); } static inline pid_t waitpid(pid_t pid, int *wait_stat, int options) { - extern int sys_wait4(int, int *, int, struct rusage *); + extern long sys_wait4(int, int *, int, struct rusage *); return sys_wait4((int)pid, wait_stat, options, NULL); } -static inline int delete_module(const char *name) +static inline long delete_module(const char *name) { - extern int sys_delete_module(const char *name); + extern long sys_delete_module(const char *name); return sys_delete_module(name); } static inline pid_t wait(int * wait_stat) { - extern int sys_wait4(int, int *, int, struct rusage *); + extern long sys_wait4(int, int *, int, struct rusage *); return sys_wait4(-1, wait_stat, 0, NULL); } @@ -395,11 +395,6 @@ static inline pid_t wait(int * wait_stat) */ static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp); -/* - * Create a new kernel thread - */ -extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); - #endif #endif /* __ASM_ARM_UNISTD_H */ |