diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
commit | dcec8a13bf565e47942a1751a9cec21bec5648fe (patch) | |
tree | 548b69625b18cc2e88c3e68d0923be546c9ebb03 /include/asm-arm | |
parent | 2e0f55e79c49509b7ff70ff1a10e1e9e90a3dfd4 (diff) |
o Merge with Linux 2.1.99.
o Fix ancient bug in the ELF loader making ldd crash.
o Fix ancient bug in the keyboard code for SGI, SNI and Jazz.
Diffstat (limited to 'include/asm-arm')
82 files changed, 1723 insertions, 683 deletions
diff --git a/include/asm-arm/a.out.h b/include/asm-arm/a.out.h index 45e4a9cd6..12df46a9a 100644 --- a/include/asm-arm/a.out.h +++ b/include/asm-arm/a.out.h @@ -1,16 +1,18 @@ #ifndef __ARM_A_OUT_H__ #define __ARM_A_OUT_H__ +#include <linux/types.h> + struct exec { - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ + __u32 a_info; /* Use macros N_MAGIC, etc for access */ + __u32 a_text; /* length of text, in bytes */ + __u32 a_data; /* length of data, in bytes */ + __u32 a_bss; /* length of uninitialized data area for file, in bytes */ + __u32 a_syms; /* length of symbol table data in file, in bytes */ + __u32 a_entry; /* start address */ + __u32 a_trsize; /* length of relocation info for text, in bytes */ + __u32 a_drsize; /* length of relocation info for data, in bytes */ }; /* diff --git a/include/asm-arm/arch-arc/a.out.h b/include/asm-arm/arch-arc/a.out.h index 985c27e90..a8ef7645f 100644 --- a/include/asm-arm/arch-arc/a.out.h +++ b/include/asm-arm/arch-arc/a.out.h @@ -2,8 +2,9 @@ * linux/include/asm-arm/arch-arc/a.out.h * * Copyright (C) 1996 Russell King + * + * Acorn Archimedes/A5000 a.out.h specs */ - #ifndef __ASM_ARCH_A_OUT_H #define __ASM_ARCH_A_OUT_H diff --git a/include/asm-arm/arch-arc/dma.h b/include/asm-arm/arch-arc/dma.h index 8e82fe58d..3420d7d6d 100644 --- a/include/asm-arm/arch-arc/dma.h +++ b/include/asm-arm/arch-arc/dma.h @@ -1,95 +1,38 @@ +/* + * linux/include/asm-arm/arch-arc/dma.h + * + * Copyright (C) 1996-1998 Russell King + * + * Acorn Archimedes/A5000 architecture virtual DMA + * implementation + * + * Modifications: + * 04-04-1998 RMK Merged arc and a5k versions + */ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H -#define MAX_DMA_ADDRESS 0x03000000 - -#ifdef KERNEL_ARCH_DMA - -static inline void arch_disable_dma (int dmanr) -{ - printk (dma_str, "arch_disable_dma", dmanr); -} +#include <linux/config.h> -static inline void arch_enable_dma (int dmanr) -{ - printk (dma_str, "arch_enable_dma", dmanr); -} - -static inline void arch_set_dma_addr (int dmanr, unsigned int addr) -{ - printk (dma_str, "arch_set_dma_addr", dmanr); -} - -static inline void arch_set_dma_count (int dmanr, unsigned int count) -{ - printk (dma_str, "arch_set_dma_count", dmanr); -} - -static inline void arch_set_dma_mode (int dmanr, char mode) -{ - printk (dma_str, "arch_set_dma_mode", dmanr); -} - -static inline int arch_dma_count (int dmanr) -{ - printk (dma_str, "arch_dma_count", dmanr); - return 0; -} - -#endif - -/* enable/disable a specific DMA channel */ -extern void enable_dma(unsigned int dmanr); - -static __inline__ void disable_dma(unsigned int dmanr) -{ - switch(dmanr) { - case 0: disable_irq(64); break; - case 1: break; - default: printk (dma_str, "disable_dma", dmanr); break; - } -} - -/* Clear the 'DMA Pointer Flip Flop'. - * Write 0 for LSB/MSB, 1 for MSB/LSB access. - * Use this once to initialize the FF to a known state. - * After that, keep track of it. :-) - * --- In order to do that, the DMA routines below should --- - * --- only be used while interrupts are disabled! --- - */ -#define clear_dma_ff(dmanr) - -/* set mode (above) for a specific DMA channel */ -extern void set_dma_mode(unsigned int dmanr, char mode); +#define MAX_DMA_ADDRESS 0x03000000 -/* Set only the page register bits of the transfer address. - * This is used for successive transfers when we know the contents of - * the lower 16 bits of the DMA current address register, but a 64k boundary - * may have been crossed. +/* + * DMA modes - we have two, IN and OUT */ -static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) -{ - printk (dma_str, "set_dma_page", dmanr); -} +typedef enum { + DMA_MODE_READ, + DMA_MODE_WRITE +} dmamode_t; +#define MAX_DMA_CHANNELS 4 -/* Set transfer address & page bits for specific DMA channel. - * Assumes dma flipflop is clear. - */ -extern void set_dma_addr(unsigned int dmanr, unsigned int addr); - -/* Set transfer size for a specific DMA channel. - */ -extern void set_dma_count(unsigned int dmanr, unsigned int count); +#define DMA_0 0 +#define DMA_1 1 +#define DMA_VIRTUAL_FLOPPY 2 +#define DMA_VIRTUAL_SOUND 3 -/* Get DMA residue count. After a DMA transfer, this - * should return zero. Reading this while a DMA transfer is - * still in progress will return unpredictable results. - * If called before the channel has been used, it may return 1. - * Otherwise, it returns the number of _bytes_ left to transfer. - * - * Assumes DMA flip-flop is clear. - */ -extern int get_dma_residue(unsigned int dmanr); +#ifdef CONFIG_ARCH_A5K +#define DMA_FLOPPY DMA_VIRTUAL_FLOPPY +#endif #endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-arc/hardware.h b/include/asm-arm/arch-arc/hardware.h index 21d933d86..4990ca132 100644 --- a/include/asm-arm/arch-arc/hardware.h +++ b/include/asm-arm/arch-arc/hardware.h @@ -3,20 +3,31 @@ * * Copyright (C) 1996 Russell King. * - * This file contains the hardware definitions of the A3/4/5xx series machines. + * This file contains the hardware definitions of the + * Acorn Archimedes/A5000 machines. + * + * Modifications: + * 04-04-1998 PJB/RMK Merged arc and a5k versions */ #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H +#include <linux/config.h> + /* - * What hardware must be present + * What hardware must be present - these can be tested by the kernel + * source. */ #define HAS_IOC #define HAS_MEMC #define HAS_MEMC1A #define HAS_VIDC +#ifdef CONFIG_ARCH_A5K +#define HAS_PCIO +#endif + /* * Optional hardware */ @@ -29,8 +40,10 @@ */ #define VIDC_BASE 0x80100000 #define IOCEC4IO_BASE 0x8009c000 +#ifdef CONFIG_ARCH_ARC #define LATCHAADDR 0x80094010 #define LATCHBADDR 0x80094006 +#endif #define IOCECIO_BASE 0x80090000 #define IOC_BASE 0x80080000 #define MEMCECIO_BASE 0x80000000 diff --git a/include/asm-arm/arch-arc/ide.h b/include/asm-arm/arch-arc/ide.h index 9da7a9c56..8cc1baaa4 100644 --- a/include/asm-arm/arch-arc/ide.h +++ b/include/asm-arm/arch-arc/ide.h @@ -2,17 +2,33 @@ * linux/include/asm-arm/arch-arc/ide.h * * Copyright (c) 1997,1998 Russell King + * + * IDE definitions for the Acorn Archimedes/A5000 + * architecture + * + * Modifications: + * 04-04-1998 PJB Merged `arc' and `a5k' versions */ +#include <linux/config.h> + static __inline__ int ide_default_irq(ide_ioreg_t base) { +#ifdef CONFIG_ARCH_A5K + if (base == 0x1f0) + return 11; +#endif return 0; } static __inline__ ide_ioreg_t ide_default_io_base(int index) { +#ifdef CONFIG_ARCH_A5K + if (index == 0) + return 0x1f0; +#endif return 0; } diff --git a/include/asm-arm/arch-arc/io.h b/include/asm-arm/arch-arc/io.h index 40775ec8f..1639e6d46 100644 --- a/include/asm-arm/arch-arc/io.h +++ b/include/asm-arm/arch-arc/io.h @@ -10,16 +10,6 @@ #define __ASM_ARM_ARCH_IO_H /* - * Virtual view <-> DMA view memory address translations - * virt_to_bus: Used to translate the virtual address to an - * address suitable to be passed to set_dma_addr - * bus_to_virt: Used to convert an address for DMA operations - * to an address that the kernel can use. - */ -#define virt_to_bus(x) ((unsigned long)(x)) -#define bus_to_virt(x) ((void *)(x)) - -/* * This architecture does not require any delayed IO, and * has the constant-optimised IO */ @@ -58,7 +48,7 @@ extern __inline__ void __outw (unsigned int value, unsigned int port) "tst %2, #0x80000000\n\t" "mov %0, %4\n\t" "addeq %0, %0, %3\n\t" - "strb %1, [%0, %2, lsl #2]" + "str %1, [%0, %2, lsl #2]" : "=&r" (temp) : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) : "cc"); @@ -71,7 +61,7 @@ extern __inline__ void __outl (unsigned int value, unsigned int port) "tst %2, #0x80000000\n\t" "mov %0, %4\n\t" "addeq %0, %0, %3\n\t" - "strb %1, [%0, %2, lsl #2]" + "str %1, [%0, %2, lsl #2]" : "=&r" (temp) : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) : "cc"); diff --git a/include/asm-arm/arch-arc/irq.h b/include/asm-arm/arch-arc/irq.h index 62ea30478..937a79c3c 100644 --- a/include/asm-arm/arch-arc/irq.h +++ b/include/asm-arm/arch-arc/irq.h @@ -6,7 +6,7 @@ * Changelog: * 24-09-1996 RMK Created * 10-10-1996 RMK Brought up to date with arch-sa110eval - * 05-11-1996 RMK Changed interrupt numbers & uses new inb/outb macros + * 22-10-1996 RMK Changed interrupt numbers & uses new inb/outb macros * 11-01-1998 RMK Added mask_and_ack_irq */ diff --git a/include/asm-arm/arch-arc/irqs.h b/include/asm-arm/arch-arc/irqs.h index e4043aaef..48e90b1d7 100644 --- a/include/asm-arm/arch-arc/irqs.h +++ b/include/asm-arm/arch-arc/irqs.h @@ -1,12 +1,26 @@ /* * linux/include/asm-arm/arch-arc/irqs.h * - * Copyright (C) 1996 Russell King, Dave Gilbert (gilbertd@cs.man.ac.uk) + * Copyright (C) 1996 Russell King, Dave Gilbert + * + * Modifications: + * 04-04-1998 PJB Merged arc and a5k versions */ +#include <linux/config.h> + +#if defined(CONFIG_ARCH_A5K) +#define IRQ_PRINTER 0 +#define IRQ_BATLOW 1 +#define IRQ_FLOPPYINDEX 2 +#define IRQ_FLOPPYDISK 12 +#elif defined(CONFIG_ARCH_ARC) #define IRQ_PRINTERBUSY 0 -#define IRQ_SERIALRING 1 +#define IRQ_SERIALRING 1 #define IRQ_PRINTERACK 2 +#define IRQ_FLOPPYCHANGED 12 +#endif + #define IRQ_VSYNCPULSE 3 #define IRQ_POWERON 4 #define IRQ_TIMER0 5 @@ -16,15 +30,20 @@ #define IRQ_SOUNDCHANGE 9 #define IRQ_SERIALPORT 10 #define IRQ_HARDDISK 11 -#define IRQ_FLOPPYCHANGED 12 #define IRQ_EXPANSIONCARD 13 #define IRQ_KEYBOARDTX 14 #define IRQ_KEYBOARDRX 15 -#define FIQ_FLOPPYDATA 0 +#if defined(CONFIG_ARCH_A5K) +#define FIQ_SERIALPORT 4 +#elif defined(CONFIG_ARCH_ARC) #define FIQ_FLOPPYIRQ 1 +#define FIQ_FD1772 FIQ_FLOPPYIRQ +#endif + +#define FIQ_FLOPPYDATA 0 #define FIQ_ECONET 2 #define FIQ_EXPANSIONCARD 6 #define FIQ_FORCE 7 -#define FIQ_FD1772 FIQ_FLOPPYIRQ +#define IRQ_TIMER IRQ_TIMER0 diff --git a/include/asm-arm/arch-arc/keyboard.h b/include/asm-arm/arch-arc/keyboard.h new file mode 100644 index 000000000..59272e269 --- /dev/null +++ b/include/asm-arm/arch-arc/keyboard.h @@ -0,0 +1,37 @@ +/* + * linux/include/asm-arm/arch-arc/keyboard.h + * + * Keyboard driver definitions for Acorn Archimedes/A5000 + * architecture + * + * Copyright (C) 1998 Russell King + */ + +#include <asm/irq.h> + +#define NR_SCANCODES 128 + +extern int a5kkbd_translate(unsigned char scancode, unsigned char *keycode_p, char *up_flag_p); +extern void a5kkbd_leds(unsigned char leds); +extern void a5kkbd_init_hw(void); +extern unsigned char a5kkbd_sysrq_xlate[NR_SCANCODES]; + +#define kbd_setkeycode(sc,kc) (-EINVAL) +#define kbd_getkeycode(sc) (-EINVAL) + +/* Prototype: int kbd_pretranslate(scancode, raw_mode) + * Returns : 0 to ignore scancode + */ +#define kbd_pretranslate(sc,rm) (1) + +/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) + * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag + * set to 0200 if scancode indicates release + */ +#define kbd_translate(sc, kcp, ufp, rm) a5kkbd_translate(sc, kcp, ufp) +#define kbd_unexpected_up(kc) (0200) +#define kbd_leds(leds) a5kkbd_leds(leds) +#define kbd_init_hw() a5kkbd_init_hw() +#define kbd_sysrq_xlate a5kkbd_sysrq_xlate +#define kbd_disable_irq() disable_irq(IRQ_KEYBOARDRX) +#define kbd_enable_irq() enable_irq(IRQ_KEYBOARDRX) diff --git a/include/asm-arm/arch-arc/mmu.h b/include/asm-arm/arch-arc/mmu.h index 747f61ada..1e54d9863 100644 --- a/include/asm-arm/arch-arc/mmu.h +++ b/include/asm-arm/arch-arc/mmu.h @@ -9,7 +9,21 @@ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H +#define __virt_to_phys__is_a_macro #define __virt_to_phys(vpage) vpage +#define __phys_to_virt__is_a_macro #define __phys_to_virt(ppage) ppage +/* + * Virtual view <-> DMA view memory address translations + * virt_to_bus: Used to translate the virtual address to an + * address suitable to be passed to set_dma_addr + * bus_to_virt: Used to convert an address for DMA operations + * to an address that the kernel can use. + */ +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) (x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) (x) + #endif diff --git a/include/asm-arm/arch-arc/oldlatches.h b/include/asm-arm/arch-arc/oldlatches.h index 747a5e86d..3252e1109 100644 --- a/include/asm-arm/arch-arc/oldlatches.h +++ b/include/asm-arm/arch-arc/oldlatches.h @@ -1,6 +1,19 @@ -#ifndef _ASM_ARM_ARCHARC_OLDLATCH_H -#define _ASM_ARM_ARCHARC_OLDLATCH_H +/* + * linux/include/asm-arm/arch-arc/oldlatches.h + * + * Copyright (C) 1996 Russell King, Dave Gilbert + * + * Dummy oldlatches.h + * + * Modifications: + * 04-04-1998 PJB/RMK Merged arc and a5k versions + */ +#ifndef _ASM_ARCH_OLDLATCH_H +#define _ASM_ARCH_OLDLATCH_H +#include <linux/config.h> + +#if defined(CONFIG_ARCH_ARC) #define LATCHA_FDSEL0 (1<<0) #define LATCHA_FDSEL1 (1<<1) #define LATCHA_FDSEL2 (1<<2) @@ -21,4 +34,12 @@ void oldlatch_bupdate(unsigned char mask,unsigned char newdata); /* newval=(oldval & mask)|newdata */ void oldlatch_aupdate(unsigned char mask,unsigned char newdata); +#elif defined(CONFIG_ARCH_A5K) + +#ifdef __need_oldlatches +#error "Old latches not present in this (a5k) machine" +#endif + +#endif #endif + diff --git a/include/asm-arm/arch-arc/processor.h b/include/asm-arm/arch-arc/processor.h index 0d3aee84a..3acb4886e 100644 --- a/include/asm-arm/arch-arc/processor.h +++ b/include/asm-arm/arch-arc/processor.h @@ -29,6 +29,6 @@ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) #define INIT_MMAP \ -{ &init_mm, 0, 0x02000000, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } #endif diff --git a/include/asm-arm/arch-arc/serial.h b/include/asm-arm/arch-arc/serial.h index d9a6bde58..4fdfcdb21 100644 --- a/include/asm-arm/arch-arc/serial.h +++ b/include/asm-arm/arch-arc/serial.h @@ -5,10 +5,13 @@ * * Changelog: * 15-10-1996 RMK Created + * 04-04-1998 PJB Merged `arc' and `a5k' architectures */ #ifndef __ASM_ARCH_SERIAL_H #define __ASM_ARCH_SERIAL_H +#include <linux/config.h> + /* * This assumes you have a 1.8432 MHz clock for your UART. * @@ -20,6 +23,26 @@ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#if defined(CONFIG_ARCH_A5K) + /* UART CLK PORT IRQ FLAGS */ +#define RS_UARTS \ + { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + +#elif defined(CONFIG_ARCH_ARC) + /* UART CLK PORT IRQ FLAGS */ #define RS_UARTS \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS0 */ \ @@ -38,3 +61,4 @@ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ #endif +#endif diff --git a/include/asm-arm/arch-arc/system.h b/include/asm-arm/arch-arc/system.h index 6807cc66c..3becc7b2f 100644 --- a/include/asm-arm/arch-arc/system.h +++ b/include/asm-arm/arch-arc/system.h @@ -6,6 +6,10 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H +#include <linux/config.h> + +#ifdef CONFIG_ARCH_ARC + #define cliIF() \ do { \ unsigned long temp; \ @@ -17,6 +21,8 @@ : ); \ } while(0) +#endif + extern __inline__ void arch_hard_reset (void) { extern void ecard_reset (int card); diff --git a/include/asm-arm/arch-arc/timex.h b/include/asm-arm/arch-arc/timex.h index 5161a9a62..569e01bb2 100644 --- a/include/asm-arm/arch-arc/timex.h +++ b/include/asm-arm/arch-arc/timex.h @@ -1,7 +1,7 @@ /* * linux/include/asm-arm/arch-arc/timex.h * - * Archimedes architecture timex specifications + * Acorn Archimedes/A5000 architecture timex specifications * * Copyright (C) 1997, 1998 Russell King */ diff --git a/include/asm-arm/arch-arc/uncompress.h b/include/asm-arm/arch-arc/uncompress.h index e6af264b5..f3acb5c25 100644 --- a/include/asm-arm/arch-arc/uncompress.h +++ b/include/asm-arm/arch-arc/uncompress.h @@ -1,5 +1,5 @@ /* - * linux/include/asm-arm/arch-a5k/uncompress.h + * linux/include/asm-arm/arch-arc/uncompress.h * * Copyright (C) 1996 Russell King */ diff --git a/include/asm-arm/arch-ebsa110/a.out.h b/include/asm-arm/arch-ebsa110/a.out.h index a34c23ef2..0123eb29a 100644 --- a/include/asm-arm/arch-ebsa110/a.out.h +++ b/include/asm-arm/arch-ebsa110/a.out.h @@ -8,7 +8,7 @@ #define __ASM_ARCH_A_OUT_H #ifdef __KERNEL__ -#define STACK_TOP (0xc0000000) +#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) #define LIBRARY_START_TEXT (0x00c00000) #endif diff --git a/include/asm-arm/arch-ebsa110/dma.h b/include/asm-arm/arch-ebsa110/dma.h index 73340527a..96a265927 100644 --- a/include/asm-arm/arch-ebsa110/dma.h +++ b/include/asm-arm/arch-ebsa110/dma.h @@ -8,93 +8,22 @@ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H -#ifdef KERNEL_ARCH_DMA - -static inline void arch_disable_dma (int dmanr) -{ - printk (dma_str, "arch_disable_dma", dmanr); -} - -static inline void arch_enable_dma (int dmanr) -{ - printk (dma_str, "arch_enable_dma", dmanr); -} - -static inline void arch_set_dma_addr (int dmanr, unsigned int addr) -{ - printk (dma_str, "arch_set_dma_addr", dmanr); -} - -static inline void arch_set_dma_count (int dmanr, unsigned int count) -{ - printk (dma_str, "arch_set_dma_count", dmanr); -} - -static inline void arch_set_dma_mode (int dmanr, char mode) -{ - printk (dma_str, "arch_set_dma_mode", dmanr); -} - -static inline int arch_dma_count (int dmanr) -{ - printk (dma_str, "arch_dma_count", dmanr); - return 0; -} - -#endif - -/* enable/disable a specific DMA channel */ -extern void enable_dma(unsigned int dmanr); - -static __inline__ void disable_dma(unsigned int dmanr) -{ - printk (dma_str, "disable_dma", dmanr); -} - -/* Clear the 'DMA Pointer Flip Flop'. - * Write 0 for LSB/MSB, 1 for MSB/LSB access. - * Use this once to initialize the FF to a known state. - * After that, keep track of it. :-) - * --- In order to do that, the DMA routines below should --- - * --- only be used while interrupts are disabled! --- - */ -static __inline__ void clear_dma_ff(unsigned int dmanr) -{ - printk (dma_str, "clear_dma_ff", dmanr); -} - -/* set mode (above) for a specific DMA channel */ -extern void set_dma_mode(unsigned int dmanr, char mode); - -/* Set only the page register bits of the transfer address. - * This is used for successive transfers when we know the contents of - * the lower 16 bits of the DMA current address register, but a 64k boundary - * may have been crossed. - */ -static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) -{ - printk (dma_str, "set_dma_page", dmanr); -} - - -/* Set transfer address & page bits for specific DMA channel. - * Assumes dma flipflop is clear. +/* + * This is the maximum DMA address that can be DMAd to. + * There should not be more than (0xd0000000 - 0xc0000000) + * bytes of RAM. */ -extern void set_dma_addr(unsigned int dmanr, unsigned int addr); +#define MAX_DMA_ADDRESS 0xd0000000 -/* Set transfer size for a specific DMA channel. +/* + * DMA modes - we have two, IN and OUT */ -extern void set_dma_count(unsigned int dmanr, unsigned int count); +typedef enum { + DMA_MODE_READ, + DMA_MODE_WRITE +} dmamode_t; -/* Get DMA residue count. After a DMA transfer, this - * should return zero. Reading this while a DMA transfer is - * still in progress will return unpredictable results. - * If called before the channel has been used, it may return 1. - * Otherwise, it returns the number of _bytes_ left to transfer. - * - * Assumes DMA flip-flop is clear. - */ -extern int get_dma_residue(unsigned int dmanr); +#define MAX_DMA_CHANNELS 8 #endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h index 14655b47b..61ac7492e 100644 --- a/include/asm-arm/arch-ebsa110/hardware.h +++ b/include/asm-arm/arch-ebsa110/hardware.h @@ -39,6 +39,7 @@ #define MAPTOPHYS(a) ((unsigned long)(a) - PAGE_OFFSET) #define KERNTOPHYS(a) ((unsigned long)(&a)) #define KERNEL_BASE (0xc0008000) +#define SAFE_ADDR 0x40000000 #else diff --git a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h index 30621db0a..39f574d55 100644 --- a/include/asm-arm/arch-ebsa110/io.h +++ b/include/asm-arm/arch-ebsa110/io.h @@ -10,16 +10,6 @@ #define __ASM_ARM_ARCH_IO_H /* - * Virtual view <-> DMA view memory address translations - * virt_to_bus: Used to translate the virtual address to an - * address suitable to be passed to set_dma_addr - * bus_to_virt: Used to convert an address for DMA operations - * to an address that the kernel can use. - */ -#define virt_to_bus(x) ((unsigned long)(x)) -#define bus_to_virt(x) ((void *)(x)) - -/* * This architecture does not require any delayed IO, and * has the constant-optimised IO */ @@ -146,7 +136,18 @@ DECLARE_IO(long,l,"") result & 0xffff; \ }) -#define __outlc(v,p) __outwc((v),(p)) +#define __outlc(v,p) \ +({ \ + unsigned long v = value; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "str %0, [%1, %2]" \ + : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "str %0, [%1, %2]" \ + : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \ +}) #define __inlc(port) \ ({ \ diff --git a/include/asm-arm/arch-ebsa110/irqs.h b/include/asm-arm/arch-ebsa110/irqs.h index b83b5967c..016686df9 100644 --- a/include/asm-arm/arch-ebsa110/irqs.h +++ b/include/asm-arm/arch-ebsa110/irqs.h @@ -1,5 +1,5 @@ /* - * linux/include/asm-arm/arch-sa100eval/irqs.h + * linux/include/asm-arm/arch-ebsa110/irqs.h * * Copyright (C) 1996 Russell King */ @@ -12,3 +12,5 @@ #define IRQ_TIMER1 5 #define IRQ_PCMCIA 6 #define IRQ_IMMEDIATE 7 + +#define IRQ_TIMER IRQ_TIMER0 diff --git a/include/asm-arm/arch-ebsa110/mm-init.h b/include/asm-arm/arch-ebsa110/mm-init.h index 9c70f7505..3e3794140 100644 --- a/include/asm-arm/arch-ebsa110/mm-init.h +++ b/include/asm-arm/arch-ebsa110/mm-init.h @@ -1,11 +1,6 @@ /* - * linux/include/asm-arm/arch-ebsa110/mm-init.h + * linux/include/asm-arm/arch-ebsa110/mmap.h * - * Copyright (C) 1997,1998 Russell King - * - * Description of the initial memory map for EBSA-110 + * Copyright (C) 1996,1997,1998 Russell King */ -static init_mem_map_t init_mem_map[] = { - INIT_MEM_MAP_SENTINEL -}; diff --git a/include/asm-arm/arch-ebsa110/mmu.h b/include/asm-arm/arch-ebsa110/mmu.h index fb684dd74..07006f82e 100644 --- a/include/asm-arm/arch-ebsa110/mmu.h +++ b/include/asm-arm/arch-ebsa110/mmu.h @@ -13,7 +13,14 @@ /* * On ebsa, the dram is contiguous */ +#define __virt_to_phys__is_a_macro #define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET) +#define __phys_to_virt__is_a_macro #define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET) +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + #endif diff --git a/include/asm-arm/arch-ebsa110/processor.h b/include/asm-arm/arch-ebsa110/processor.h index b54085946..732c9142c 100644 --- a/include/asm-arm/arch-ebsa110/processor.h +++ b/include/asm-arm/arch-ebsa110/processor.h @@ -26,6 +26,6 @@ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) #define INIT_MMAP \ -{ &init_mm, 0xc0000000, 0xc2000000, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } #endif diff --git a/include/asm-arm/arch-ebsa285/a.out.h b/include/asm-arm/arch-ebsa285/a.out.h new file mode 100644 index 000000000..0123eb29a --- /dev/null +++ b/include/asm-arm/arch-ebsa285/a.out.h @@ -0,0 +1,16 @@ +/* + * linux/include/asm-arm/arch-ebsa110/a.out.h + * + * Copyright (C) 1996 Russell King + */ + +#ifndef __ASM_ARCH_A_OUT_H +#define __ASM_ARCH_A_OUT_H + +#ifdef __KERNEL__ +#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) +#define LIBRARY_START_TEXT (0x00c00000) +#endif + +#endif + diff --git a/include/asm-arm/arch-ebsa285/dma.h b/include/asm-arm/arch-ebsa285/dma.h new file mode 100644 index 000000000..96a265927 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/dma.h @@ -0,0 +1,29 @@ +/* + * linux/include/asm-arm/arch-ebsa110/dma.h + * + * Architecture DMA routes + * + * Copyright (C) 1997.1998 Russell King + */ +#ifndef __ASM_ARCH_DMA_H +#define __ASM_ARCH_DMA_H + +/* + * This is the maximum DMA address that can be DMAd to. + * There should not be more than (0xd0000000 - 0xc0000000) + * bytes of RAM. + */ +#define MAX_DMA_ADDRESS 0xd0000000 + +/* + * DMA modes - we have two, IN and OUT + */ +typedef enum { + DMA_MODE_READ, + DMA_MODE_WRITE +} dmamode_t; + +#define MAX_DMA_CHANNELS 8 + +#endif /* _ASM_ARCH_DMA_H */ + diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h new file mode 100644 index 000000000..8d6af3b1b --- /dev/null +++ b/include/asm-arm/arch-ebsa285/hardware.h @@ -0,0 +1,114 @@ +/* + * linux/include/asm-arm/arch-ebsa285/hardware.h + * + * Copyright (C) 1998 Russell King. + * + * This file contains the hardware definitions of the EBSA-285. + */ + + +/* Logical Physical + * 0xfff00000 0x40000000 X-Bus + * 0xffe00000 0x7c000000 PCI I/O space + * + * 0xfe000000 0x42000000 CSR + * 0xfd000000 0x78000000 Outbound write flush + * 0xfc000000 0x79000000 PCI IACK/special space + * + * 0xf9030000 0x7a080000 PCI Config type 1 card 4 + * 0xf9020000 0x7a040000 PCI Config type 1 card 3 + * 0xf9010000 0x7a020000 PCI Config type 1 card 2 + * 0xf9000000 0x7a010000 PCI Config type 1 card 1 + * + * 0xf8030000 0x7b080000 PCI Config type 0 card 4 + * 0xf8020000 0x7b040000 PCI Config type 0 card 3 + * 0xf8010000 0x7b020000 PCI Config type 0 card 2 + * 0xf8000000 0x7b010000 PCI Config type 0 card 1 + * + */ + +#define IO_END 0xffffffff +#define IO_BASE 0xe0000000 +#define IO_SIZE (IO_END - IO_BASE) + +#define HAS_PCIO + +#define XBUS_LEDS ((volatile unsigned char *)0xfff12000) +#define XBUS_LED_AMBER (1 << 0) +#define XBUS_LED_GREEN (1 << 1) +#define XBUS_LED_RED (1 << 2) +#define XBUS_LED_TOGGLE (1 << 8) + +#define XBUS_SWITCH ((volatile unsigned char *)0xfff12000) +#define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15) +#define XBUS_SWITCH_J17_13 ((*XBUS_SWITCH) & (1 << 4)) +#define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5)) +#define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6)) + +#define PCIO_BASE 0xffe00000 + +#define CSR_SA110_CNTL ((volatile unsigned long *)0xfe00013c) +#define CSR_PCIADDR_EXTN ((volatile unsigned long *)0xfe000140) +#define CSR_PREFETCHMEMRANGE ((volatile unsigned long *)0xfe000144) +#define CSR_XBUS_CYCLE ((volatile unsigned long *)0xfe000148) +#define CSR_XBUS_IOSTROBE ((volatile unsigned long *)0xfe00014c) +#define CSR_DOORBELL_PCI ((volatile unsigned long *)0xfe000150) +#define CSR_DOORBELL_SA110 ((volatile unsigned long *)0xfe000154) + + +#define CSR_UARTDR ((volatile unsigned long *)0xfe000160) +#define CSR_RXSTAT ((volatile unsigned long *)0xfe000164) +#define CSR_H_UBRLCR ((volatile unsigned long *)0xfe000168) +#define CSR_M_UBRLCR ((volatile unsigned long *)0xfe00016c) +#define CSR_L_UBRLCR ((volatile unsigned long *)0xfe000170) +#define CSR_UARTCON ((volatile unsigned long *)0xfe000174) +#define CSR_UARTFLG ((volatile unsigned long *)0xfe000178) + +#define CSR_IRQ_STATUS ((volatile unsigned long *)0xfe000180) +#define CSR_IRQ_RAWSTATUS ((volatile unsigned long *)0xfe000184) +#define CSR_IRQ_ENABLE ((volatile unsigned long *)0xfe000188) +#define CSR_IRQ_DISABLE ((volatile unsigned long *)0xfe00018c) +#define CSR_IRQ_SOFT ((volatile unsigned long *)0xfe000190) + +#define CSR_FIQ_STATUS ((volatile unsigned long *)0xfe000280) +#define CSR_FIQ_RAWSTATUS ((volatile unsigned long *)0xfe000284) +#define CSR_FIQ_ENABLE ((volatile unsigned long *)0xfe000288) +#define CSR_FIQ_DISABLE ((volatile unsigned long *)0xfe00028c) +#define CSR_FIQ_SOFT ((volatile unsigned long *)0xfe000290) + +#define CSR_TIMER1_LOAD ((volatile unsigned long *)0xfe000300) +#define CSR_TIMER1_VALUE ((volatile unsigned long *)0xfe000304) +#define CSR_TIMER1_CNTL ((volatile unsigned long *)0xfe000308) +#define CSR_TIMER1_CLR ((volatile unsigned long *)0xfe00030c) + +#define CSR_TIMER2_LOAD ((volatile unsigned long *)0xfe000320) +#define CSR_TIMER2_VALUE ((volatile unsigned long *)0xfe000324) +#define CSR_TIMER2_CNTL ((volatile unsigned long *)0xfe000328) +#define CSR_TIMER2_CLR ((volatile unsigned long *)0xfe00032c) + +#define CSR_TIMER3_LOAD ((volatile unsigned long *)0xfe000340) +#define CSR_TIMER3_VALUE ((volatile unsigned long *)0xfe000344) +#define CSR_TIMER3_CNTL ((volatile unsigned long *)0xfe000348) +#define CSR_TIMER3_CLR ((volatile unsigned long *)0xfe00034c) + +#define CSR_TIMER4_LOAD ((volatile unsigned long *)0xfe000360) +#define CSR_TIMER4_VALUE ((volatile unsigned long *)0xfe000364) +#define CSR_TIMER4_CNTL ((volatile unsigned long *)0xfe000368) +#define CSR_TIMER4_CLR ((volatile unsigned long *)0xfe00036c) + + +#define TIMER_CNTL_ENABLE (1 << 7) +#define TIMER_CNTL_AUTORELOAD (1 << 6) +#define TIMER_CNTL_DIV1 (0) +#define TIMER_CNTL_DIV16 (1 << 2) +#define TIMER_CNTL_DIV256 (2 << 2) +#define TIMER_CNTL_CNTEXT (3 << 2) + + +#define KERNTOPHYS(a) ((unsigned long)(&a)) + +#define PARAMS_OFFSET 0x0100 +#define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) + +#define SAFE_ADDR 0x50000000 + diff --git a/include/asm-arm/arch-ebsa285/ide.h b/include/asm-arm/arch-ebsa285/ide.h new file mode 100644 index 000000000..35eff5c28 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/ide.h @@ -0,0 +1 @@ +/* no ide */ diff --git a/include/asm-arm/arch-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h new file mode 100644 index 000000000..5142e9126 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/io.h @@ -0,0 +1,143 @@ +/* + * linux/include/asm-arm/arch-ebsa110/io.h + * + * Copyright (C) 1997,1998 Russell King + * + * Modifications: + * 06-Dec-1997 RMK Created. + */ +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +/* + * This architecture does not require any delayed IO, and + * has the constant-optimised IO + */ +#undef ARCH_IO_DELAY + +/* + * Dynamic IO functions - let the compiler + * optimize the expressions + */ +#define DECLARE_DYN_OUT(fnsuffix,instr,typ) \ +extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ +{ \ + __asm__ __volatile__( \ + "str" ##instr## " %0, [%1, %2]" \ + : \ + : "r" (value), "r" (PCIO_BASE), typ (port)); \ +} + +#define DECLARE_DYN_IN(sz,fnsuffix,instr,typ) \ +extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ +{ \ + unsigned long value; \ + __asm__ __volatile__( \ + "ldr" ##instr## " %0, [%1, %2]" \ + : "=&r" (value) \ + : "r" (PCIO_BASE), typ (port)); \ + return (unsigned sz)value; \ +} + +extern __inline__ unsigned int __ioaddr (unsigned int port) \ +{ \ + return (unsigned int)(PCIO_BASE + port); \ +} + +#define DECLARE_IO(sz,fnsuffix,instr,typ) \ + DECLARE_DYN_OUT(fnsuffix,instr,typ) \ + DECLARE_DYN_IN(sz,fnsuffix,instr,typ) + +DECLARE_IO(char,b,"b","Jr") +DECLARE_IO(short,w,"h","r") +DECLARE_IO(long,l,"","Jr") + +#undef DECLARE_IO +#undef DECLARE_DYN_OUT +#undef DECLARE_DYN_IN + +/* + * Constant address IO functions + * + * These have to be macros for the 'J' constraint to work - + * +/-4096 immediate operand. + */ +#define __outbc(value,port) \ +({ \ + __asm__ __volatile__( \ + "strb %0, [%1, %2]" \ + : \ + : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ +}) + +#define __inbc(port) \ +({ \ + unsigned char result; \ + __asm__ __volatile__( \ + "ldrb %0, [%1, %2]" \ + : "=r" (result) \ + : "r" (PCIO_BASE), "Jr" (port)); \ + result; \ +}) + +#define __outwc(value,port) \ +({ \ + __asm__ __volatile__( \ + "strh %0, [%1, %2]" \ + : \ + : "r" (value), "r" (PCIO_BASE), "r" (port)); \ +}) + +#define __inwc(port) \ +({ \ + unsigned short result; \ + __asm__ __volatile__( \ + "ldrh %0, [%1, %2]" \ + : "=r" (result) \ + : "r" (PCIO_BASE), "r" (port)); \ + result & 0xffff; \ +}) + +#define __outlc(value,port) \ +({ \ + __asm__ __volatile__( \ + "str %0, [%1, %2]" \ + : \ + : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ +}) + +#define __inlc(port) \ +({ \ + unsigned long result; \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2]" \ + : "=r" (result) \ + : "r" (PCIO_BASE), "Jr" (port)); \ + result; \ +}) + +#define __ioaddrc(port) \ +({ \ + unsigned long addr; \ + addr = PCIO_BASE + port; \ + addr; \ +}) + +/* + * Translated address IO functions + * + * IO address has already been translated to a virtual address + */ +#define outb_t(v,p) \ + (*(volatile unsigned char *)(p) = (v)) + +#define inb_t(p) \ + (*(volatile unsigned char *)(p)) + +#define outl_t(v,p) \ + (*(volatile unsigned long *)(p) = (v)) + +#define inl_t(p) \ + (*(volatile unsigned long *)(p)) + +#endif diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h new file mode 100644 index 000000000..ece9464cd --- /dev/null +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -0,0 +1,34 @@ +/* + * include/asm-arm/arch-ebsa110/irq.h + * + * Copyright (C) 1996,1997,1998 Russell King + */ + +static __inline__ void mask_and_ack_irq(unsigned int irq) +{ + if (irq < 32) + *CSR_IRQ_DISABLE = 1 << irq; +} + +static __inline__ void mask_irq(unsigned int irq) +{ + if (irq < 32) + *CSR_IRQ_DISABLE = 1 << irq; +} + +static __inline__ void unmask_irq(unsigned int irq) +{ + if (irq < 32) + *CSR_IRQ_ENABLE = 1 << irq; +} + +static __inline__ unsigned long get_enabled_irqs(void) +{ + return 0; +} + +static __inline__ void irq_init_irq(void) +{ + *CSR_IRQ_DISABLE = -1; + *CSR_FIQ_DISABLE = -1; +} diff --git a/include/asm-arm/arch-ebsa285/irqs.h b/include/asm-arm/arch-ebsa285/irqs.h new file mode 100644 index 000000000..108767689 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/irqs.h @@ -0,0 +1,45 @@ +/* + * linux/include/asm-arm/arch-ebsa285/irqs.h + * + * Copyright (C) 1998 Russell King + */ + +#define NR_IRQS 32 + +/* + * This is a list of all interrupts that the 21285 + * can generate + */ +#define IRQ_RESERVED 0 +#define IRQ_SOFTIRQ 1 +#define IRQ_CONRX 2 +#define IRQ_CONTX 3 +#define IRQ_TIMER1 4 +#define IRQ_TIMER2 5 +#define IRQ_TIMER3 6 +#define IRQ_TIMER4 7 +#define IRQ_IN0 8 +#define IRQ_IN1 9 +#define IRQ_IN2 10 +#define IRQ_IN3 11 +#define IRQ_XCS0 12 +#define IRQ_XCS1 13 +#define IRQ_XCS2 14 +#define IRQ_DOORBELLHOST 15 +#define IRQ_DMA1 16 +#define IRQ_DMA2 17 +#define IRQ_PCI 18 +#define IRQ_BIST 22 +#define IRQ_SERR 23 +#define IRQ_SDRAMPARITY 24 +#define IRQ_I2OINPOST 25 +#define IRQ_DISCARDTIMER 27 +#define IRQ_PCIDATAPARITY 28 +#define IRQ_PCIMASTERABORT 29 +#define IRQ_PCITARGETABORT 30 +#define IRQ_PCIPARITY 31 + +/* + * Now map them to the Linux interrupts + */ +#define IRQ_TIMER IRQ_TIMER1 diff --git a/include/asm-arm/arch-ebsa285/keyboard.h b/include/asm-arm/arch-ebsa285/keyboard.h new file mode 100644 index 000000000..4620ff165 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/keyboard.h @@ -0,0 +1,37 @@ +/* + * linux/include/asm-arm/arch-ebsa285/keyboard.h + * + * Keyboard driver definitions for EBSA285 architecture + * + * (C) 1998 Russell King + */ + +#include <linux/config.h> +#include <asm/irq.h> + +#define NR_SCANCODES 128 + +#ifdef CONFIG_MAGIC_SYSRQ +static unsigned char kbd_sysrq_xlate[NR_SCANCODES]; +#endif + +#define kbd_setkeycode(sc,kc) (-EINVAL) +#define kbd_getkeycode(sc) (-EINVAL) + +/* Prototype: int kbd_pretranslate(scancode, raw_mode) + * Returns : 0 to ignore scancode + */ +#define kbd_pretranslate(sc,rm) (1) + +/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) + * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag + * set to 0200 if scancode indicates release + */ +#define kbd_translate(sc, kcp, ufp, rm) (1) +#define kbd_unexpected_up(kc) (0200) +#define kbd_leds(leds) +#define kbd_init_hw() +//#define kbd_sysrq_xlate ps2kbd_sysrq_xlate +#define kbd_disable_irq() +#define kbd_enable_irq() + diff --git a/include/asm-arm/arch-ebsa285/mm-init.h b/include/asm-arm/arch-ebsa285/mm-init.h new file mode 100644 index 000000000..c6937abd0 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/mm-init.h @@ -0,0 +1,5 @@ +/* + * linux/include/asm-arm/arch-ebsa110/mmap.h + * + * Copyright (C) 1996,1997,1998 Russell King + */ diff --git a/include/asm-arm/arch-ebsa285/mmu.h b/include/asm-arm/arch-ebsa285/mmu.h new file mode 100644 index 000000000..07006f82e --- /dev/null +++ b/include/asm-arm/arch-ebsa285/mmu.h @@ -0,0 +1,26 @@ +/* + * linux/include/asm-arm/arch-ebsa110/mmu.h + * + * Copyright (c) 1996,1997,1998 Russell King. + * + * Changelog: + * 20-10-1996 RMK Created + * 31-12-1997 RMK Fixed definitions to reduce warnings + */ +#ifndef __ASM_ARCH_MMU_H +#define __ASM_ARCH_MMU_H + +/* + * On ebsa, the dram is contiguous + */ +#define __virt_to_phys__is_a_macro +#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET) +#define __phys_to_virt__is_a_macro +#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET) + +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + +#endif diff --git a/include/asm-arm/arch-ebsa285/oldlatches.h b/include/asm-arm/arch-ebsa285/oldlatches.h new file mode 100644 index 000000000..8ff6ebd67 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/oldlatches.h @@ -0,0 +1,9 @@ +/* + * Dummy oldlatches.h + * + * Copyright (C) 1996 Russell King + */ + +#ifdef __need_oldlatches +#error "Old latches not present in this (rpc) machine" +#endif diff --git a/include/asm-arm/arch-ebsa285/processor.h b/include/asm-arm/arch-ebsa285/processor.h new file mode 100644 index 000000000..732c9142c --- /dev/null +++ b/include/asm-arm/arch-ebsa285/processor.h @@ -0,0 +1,31 @@ +/* + * linux/include/asm-arm/arch-ebsa110/processor.h + * + * Copyright (C) 1996,1997,1998 Russell King + */ + +#ifndef __ASM_ARCH_PROCESSOR_H +#define __ASM_ARCH_PROCESSOR_H + +/* + * Bus types + */ +#define EISA_bus 0 +#define EISA_bus__is_a_macro /* for versions in ksyms.c */ +#define MCA_bus 0 +#define MCA_bus__is_a_macro /* for versions in ksyms.c */ + +/* + * User space: 3GB + */ +#define TASK_SIZE (0xc0000000UL) + +/* This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + +#define INIT_MMAP \ +{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } + +#endif diff --git a/include/asm-arm/arch-ebsa285/shmparam.h b/include/asm-arm/arch-ebsa285/shmparam.h new file mode 100644 index 000000000..9c36489cb --- /dev/null +++ b/include/asm-arm/arch-ebsa285/shmparam.h @@ -0,0 +1,5 @@ +/* + * linux/include/asm-arm/arch-ebsa110/shmparam.h + * + * Copyright (c) 1996 Russell King. + */ diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h new file mode 100644 index 000000000..a3fed312c --- /dev/null +++ b/include/asm-arm/arch-ebsa285/system.h @@ -0,0 +1,24 @@ +/* + * linux/include/asm-arm/arch-ebsa285/system.h + * + * Copyright (c) 1996,1997,1998 Russell King. + */ +#include <asm/hardware.h> +#include <asm/leds.h> + +/* To reboot, we set up the 21285 watchdog and enable it. + * We then wait for it to timeout. + */ +extern __inline__ void arch_hard_reset (void) +{ + cli(); + *CSR_TIMER4_LOAD = 0x8000; + *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; + *CSR_SA110_CNTL |= 1 << 13; + while(1); +} + +#define ARCH_IDLE_OK + +#define arch_start_idle() leds_event(led_idle_start) +#define arch_end_idle() leds_event(led_idle_end) diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h new file mode 100644 index 000000000..cbc53293a --- /dev/null +++ b/include/asm-arm/arch-ebsa285/time.h @@ -0,0 +1,57 @@ +/* + * linux/include/asm-arm/arch-ebsa285/time.h + * + * Copyright (c) 1998 Russell King. + * + * No real time clock on the evalulation board! + * + * Changelog: + * 21-Mar-1998 RMK Created + */ + +#include <asm/leds.h> + +extern __inline__ unsigned long gettimeoffset (void) +{ + return 0; +} + +extern __inline__ int reset_timer (void) +{ + static unsigned int count = 50; + static int last_pid; + + *CSR_TIMER1_CLR = 0; + + if (current->pid != last_pid) { + last_pid = current->pid; + if (last_pid) + leds_event(led_idle_end); + else + leds_event(led_idle_start); + } + + if (--count == 0) { + count = 50; + leds_event(led_timer); + } + + return 1; +} + +/* + * We don't have a RTC to update! + */ +#define update_rtc() + +/* + * Set up timer interrupt, and return the current time in seconds. + */ +extern __inline__ unsigned long setup_timer (void) +{ + *CSR_TIMER1_CLR = 0; + *CSR_TIMER1_LOAD = LATCH; + *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; + + return mktime(1970, 1, 1, 0, 0, 0); +} diff --git a/include/asm-arm/arch-ebsa285/timex.h b/include/asm-arm/arch-ebsa285/timex.h new file mode 100644 index 000000000..0a730a70e --- /dev/null +++ b/include/asm-arm/arch-ebsa285/timex.h @@ -0,0 +1,14 @@ +/* + * linux/include/asm-arm/arch-ebsa285/timex.h + * + * EBSA285 architecture timex specifications + * + * Copyright (C) 1998 Russell King + */ + +/* + * On the EBSA, the clock ticks at weird rates. + * This is therefore not used to calculate the + * divisor. + */ +#define CLOCK_TICK_RATE (50000000 / 16) diff --git a/include/asm-arm/arch-ebsa285/uncompress.h b/include/asm-arm/arch-ebsa285/uncompress.h new file mode 100644 index 000000000..d5260b027 --- /dev/null +++ b/include/asm-arm/arch-ebsa285/uncompress.h @@ -0,0 +1,33 @@ +/* + * linux/include/asm-arm/arch-ebsa110/uncompress.h + * + * Copyright (C) 1996,1997,1998 Russell King + */ + +/* + * This does not append a newline + */ +static void puts(const char *s) +{ + __asm__ __volatile__(" + ldrb %0, [%2], #1 + teq %0, #0 + beq 3f +1: strb %0, [%3] +2: ldrb %1, [%3, #0x14] + and %1, %1, #0x60 + teq %1, #0x60 + bne 2b + teq %0, #'\n' + moveq %0, #'\r' + beq 1b + ldrb %0, [%2], #1 + teq %0, #0 + bne 1b +3: " : : "r" (0), "r" (0), "r" (s), "r" (0xf0000be0) : "cc"); +} + +/* + * nothing to do + */ +#define arch_decomp_setup() diff --git a/include/asm-arm/arch-nexuspci/a.out.h b/include/asm-arm/arch-nexuspci/a.out.h index b8e278074..ad8369c4e 100644 --- a/include/asm-arm/arch-nexuspci/a.out.h +++ b/include/asm-arm/arch-nexuspci/a.out.h @@ -8,7 +8,7 @@ #define __ASM_ARCH_A_OUT_H #ifdef __KERNEL__ -#define STACK_TOP (0xc0000000) +#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) #define LIBRARY_START_TEXT (0x00c00000) #endif diff --git a/include/asm-arm/arch-nexuspci/dma.h b/include/asm-arm/arch-nexuspci/dma.h index 73340527a..9b181743c 100644 --- a/include/asm-arm/arch-nexuspci/dma.h +++ b/include/asm-arm/arch-nexuspci/dma.h @@ -1,100 +1,17 @@ /* - * linux/include/asm-arm/arch-ebsa110/dma.h + * linux/include/asm-arm/arch-nexuspci/dma.h * - * Architecture DMA routes + * Architecture DMA routines * - * Copyright (C) 1997.1998 Russell King + * Copyright (C) 1998 Philip Blundell */ + #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H -#ifdef KERNEL_ARCH_DMA - -static inline void arch_disable_dma (int dmanr) -{ - printk (dma_str, "arch_disable_dma", dmanr); -} - -static inline void arch_enable_dma (int dmanr) -{ - printk (dma_str, "arch_enable_dma", dmanr); -} - -static inline void arch_set_dma_addr (int dmanr, unsigned int addr) -{ - printk (dma_str, "arch_set_dma_addr", dmanr); -} - -static inline void arch_set_dma_count (int dmanr, unsigned int count) -{ - printk (dma_str, "arch_set_dma_count", dmanr); -} - -static inline void arch_set_dma_mode (int dmanr, char mode) -{ - printk (dma_str, "arch_set_dma_mode", dmanr); -} - -static inline int arch_dma_count (int dmanr) -{ - printk (dma_str, "arch_dma_count", dmanr); - return 0; -} - -#endif - -/* enable/disable a specific DMA channel */ -extern void enable_dma(unsigned int dmanr); - -static __inline__ void disable_dma(unsigned int dmanr) -{ - printk (dma_str, "disable_dma", dmanr); -} - -/* Clear the 'DMA Pointer Flip Flop'. - * Write 0 for LSB/MSB, 1 for MSB/LSB access. - * Use this once to initialize the FF to a known state. - * After that, keep track of it. :-) - * --- In order to do that, the DMA routines below should --- - * --- only be used while interrupts are disabled! --- - */ -static __inline__ void clear_dma_ff(unsigned int dmanr) -{ - printk (dma_str, "clear_dma_ff", dmanr); -} - -/* set mode (above) for a specific DMA channel */ -extern void set_dma_mode(unsigned int dmanr, char mode); - -/* Set only the page register bits of the transfer address. - * This is used for successive transfers when we know the contents of - * the lower 16 bits of the DMA current address register, but a 64k boundary - * may have been crossed. - */ -static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) -{ - printk (dma_str, "set_dma_page", dmanr); -} - +/* NexusPCI has no DMA */ -/* Set transfer address & page bits for specific DMA channel. - * Assumes dma flipflop is clear. - */ -extern void set_dma_addr(unsigned int dmanr, unsigned int addr); - -/* Set transfer size for a specific DMA channel. - */ -extern void set_dma_count(unsigned int dmanr, unsigned int count); - -/* Get DMA residue count. After a DMA transfer, this - * should return zero. Reading this while a DMA transfer is - * still in progress will return unpredictable results. - * If called before the channel has been used, it may return 1. - * Otherwise, it returns the number of _bytes_ left to transfer. - * - * Assumes DMA flip-flop is clear. - */ -extern int get_dma_residue(unsigned int dmanr); +#warning No DMA on this platform #endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-nexuspci/hardware.h b/include/asm-arm/arch-nexuspci/hardware.h index 154bce9df..c1534ade6 100644 --- a/include/asm-arm/arch-nexuspci/hardware.h +++ b/include/asm-arm/arch-nexuspci/hardware.h @@ -30,6 +30,7 @@ #define MAPTOPHYS(a) ((unsigned long)(a) - PAGE_OFFSET + RAM_BASE) #define KERNTOPHYS(a) ((unsigned long)(&a)) #define KERNEL_BASE (0xc0008000) +#define SAFE_ADDR 0x40000000 #else diff --git a/include/asm-arm/arch-nexuspci/irqs.h b/include/asm-arm/arch-nexuspci/irqs.h index 661af14a1..054d0675b 100644 --- a/include/asm-arm/arch-nexuspci/irqs.h +++ b/include/asm-arm/arch-nexuspci/irqs.h @@ -5,10 +5,12 @@ */ #define IRQ_DUART 0 -#define IRQ_TIMER0 0 /* timer is part of the DUART */ #define IRQ_PLX 1 #define IRQ_PCI_D 2 #define IRQ_PCI_C 3 #define IRQ_PCI_B 4 #define IRQ_PCI_A 5 -#define IRQ_SYSERR 6 /* must ask JB about this one */ +#define IRQ_SYSERR 6 + +/* timer is part of the DUART */ +#define IRQ_TIMER IRQ_DUART diff --git a/include/asm-arm/arch-nexuspci/mm-init.h b/include/asm-arm/arch-nexuspci/mm-init.h new file mode 100644 index 000000000..93887c95d --- /dev/null +++ b/include/asm-arm/arch-nexuspci/mm-init.h @@ -0,0 +1,5 @@ +/* + * linux/include/asm-arm/arch-nexuspci/mmap.h + * + * Copyright (C) 1998 Philip Blundell + */ diff --git a/include/asm-arm/arch-nexuspci/processor.h b/include/asm-arm/arch-nexuspci/processor.h index b54085946..46bf157a4 100644 --- a/include/asm-arm/arch-nexuspci/processor.h +++ b/include/asm-arm/arch-nexuspci/processor.h @@ -1,5 +1,6 @@ /* * linux/include/asm-arm/arch-ebsa110/processor.h + * from linux/include/asm-arm/arch-ebsa110/processor.h * * Copyright (C) 1996,1997,1998 Russell King */ @@ -26,6 +27,6 @@ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) #define INIT_MMAP \ -{ &init_mm, 0xc0000000, 0xc2000000, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } #endif diff --git a/include/asm-arm/arch-nexuspci/uncompress.h b/include/asm-arm/arch-nexuspci/uncompress.h index 16daee5b9..4332c4a94 100644 --- a/include/asm-arm/arch-nexuspci/uncompress.h +++ b/include/asm-arm/arch-nexuspci/uncompress.h @@ -1,5 +1,6 @@ /* - * linux/include/asm-arm/arch-ebsa110/uncompress.h + * linux/include/asm-arm/arch-nexuspci/uncompress.h + * from linux/include/asm-arm/arch-ebsa110/uncompress.h * * Copyright (C) 1996,1997,1998 Russell King */ diff --git a/include/asm-arm/arch-rpc/a.out.h b/include/asm-arm/arch-rpc/a.out.h index c9a1d0413..6b55ee076 100644 --- a/include/asm-arm/arch-rpc/a.out.h +++ b/include/asm-arm/arch-rpc/a.out.h @@ -8,7 +8,7 @@ #define __ASM_ARCH_A_OUT_H #ifdef __KERNEL__ -#define STACK_TOP (0xc0000000) +#define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) #define LIBRARY_START_TEXT (0x00c00000) #endif diff --git a/include/asm-arm/arch-rpc/dma.h b/include/asm-arm/arch-rpc/dma.h index 540ac46f1..0f556e856 100644 --- a/include/asm-arm/arch-rpc/dma.h +++ b/include/asm-arm/arch-rpc/dma.h @@ -1,128 +1,33 @@ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H -#define MAX_DMA_ADDRESS 0xd0000000 - -#ifdef KERNEL_ARCH_DMA - -static unsigned char arch_dma_setup; -unsigned char arch_dma_ctrl[8]; -unsigned long arch_dma_addr[8]; -unsigned long arch_dma_cnt[8]; - -static inline void arch_enable_dma(int dmanr) -{ - if (!(arch_dma_setup & (1 << dmanr))) { - arch_dma_setup |= 1 << dmanr; -/* dma_interrupt (16 + dmanr);*/ - } - arch_dma_ctrl[dmanr] |= DMA_CR_E; - switch (dmanr) { - case 0: outb (arch_dma_ctrl[0], IOMD_IO0CR); break; - case 1: outb (arch_dma_ctrl[1], IOMD_IO1CR); break; - case 2: outb (arch_dma_ctrl[2], IOMD_IO2CR); break; - case 3: outb (arch_dma_ctrl[3], IOMD_IO3CR); break; - case 4: outb (arch_dma_ctrl[4], IOMD_SD0CR); break; - case 5: outb (arch_dma_ctrl[5], IOMD_SD1CR); break; - } -} - -static inline void arch_disable_dma(int dmanr) -{ - arch_dma_ctrl[dmanr] &= ~DMA_CR_E; - switch (dmanr) { - case 0: outb (arch_dma_ctrl[0], IOMD_IO0CR); break; - case 1: outb (arch_dma_ctrl[1], IOMD_IO1CR); break; - case 2: outb (arch_dma_ctrl[2], IOMD_IO2CR); break; - case 3: outb (arch_dma_ctrl[3], IOMD_IO3CR); break; - case 4: outb (arch_dma_ctrl[4], IOMD_SD0CR); break; - case 5: outb (arch_dma_ctrl[5], IOMD_SD1CR); break; - } -} - -static inline void arch_set_dma_addr(int dmanr, unsigned int addr) -{ - arch_dma_setup &= ~dmanr; - arch_dma_addr[dmanr] = addr; -} - -static inline void arch_set_dma_count(int dmanr, unsigned int count) -{ - arch_dma_setup &= ~dmanr; - arch_dma_cnt[dmanr] = count; -} - -static inline void arch_set_dma_mode(int dmanr, char mode) -{ - switch (mode) { - case DMA_MODE_READ: - arch_dma_ctrl[dmanr] |= DMA_CR_D; - break; - case DMA_MODE_WRITE: - arch_dma_ctrl[dmanr] &= ~DMA_CR_D; - break; - } -} - -static inline int arch_dma_count (int dmanr) -{ - return arch_dma_cnt[dmanr]; -} -#endif - -/* enable/disable a specific DMA channel */ -extern void enable_dma(unsigned int dmanr); - -static __inline__ void disable_dma(unsigned int dmanr) -{ - switch(dmanr) { - case 1: break; - case 2: disable_irq(64); break; - default: printk(dma_str, "disable_dma", dmanr); break; - } -} - -/* Clear the 'DMA Pointer Flip Flop'. - * Write 0 for LSB/MSB, 1 for MSB/LSB access. - * Use this once to initialize the FF to a known state. - * After that, keep track of it. :-) - * --- In order to do that, the DMA routines below should --- - * --- only be used while interrupts are disabled! --- - */ -#define clear_dma_ff(dmanr) - -/* set mode (above) for a specific DMA channel */ -extern void set_dma_mode(unsigned int dmanr, char mode); - -/* Set only the page register bits of the transfer address. - * This is used for successive transfers when we know the contents of - * the lower 16 bits of the DMA current address register, but a 64k boundary - * may have been crossed. - */ -static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) -{ - printk (dma_str, "set_dma_page", dmanr); -} - - -/* Set transfer address & page bits for specific DMA channel. - * Assumes dma flipflop is clear. +/* + * This is the maximum DMA address that can be DMAd to. + * There should not be more than (0xd0000000 - 0xc0000000) + * bytes of RAM. */ -extern void set_dma_addr(unsigned int dmanr, unsigned int addr); - -/* Set transfer size for a specific DMA channel. - */ -extern void set_dma_count(unsigned int dmanr, unsigned int count); +#define MAX_DMA_ADDRESS 0xd0000000 -/* Get DMA residue count. After a DMA transfer, this - * should return zero. Reading this while a DMA transfer is - * still in progress will return unpredictable results. - * If called before the channel has been used, it may return 1. - * Otherwise, it returns the number of _bytes_ left to transfer. - * - * Assumes DMA flip-flop is clear. +/* + * DMA modes - we have two, IN and OUT */ -extern int get_dma_residue(unsigned int dmanr); +typedef enum { + DMA_MODE_READ, + DMA_MODE_WRITE +} dmamode_t; + +#define MAX_DMA_CHANNELS 8 + +#define DMA_0 0 +#define DMA_1 1 +#define DMA_2 2 +#define DMA_3 3 +#define DMA_S0 4 +#define DMA_S1 5 +#define DMA_VIRTUAL_FLOPPY 6 +#define DMA_VIRTUAL_SOUND 7 + +#define DMA_FLOPPY DMA_VIRTUAL_FLOPPY #endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h index 2bdd96c6f..75e112e98 100644 --- a/include/asm-arm/arch-rpc/hardware.h +++ b/include/asm-arm/arch-rpc/hardware.h @@ -85,6 +85,7 @@ #define KERNEL_BASE (PAGE_OFFSET + KERNEL_OFFSET) #define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) #define Z_PARAMS_BASE (RAM_START + PARAMS_OFFSET) +#define SAFE_ADDR 0x00000000 /* ROM */ #else diff --git a/include/asm-arm/arch-rpc/io.h b/include/asm-arm/arch-rpc/io.h index b78483cc8..43d787b96 100644 --- a/include/asm-arm/arch-rpc/io.h +++ b/include/asm-arm/arch-rpc/io.h @@ -10,16 +10,6 @@ #define __ASM_ARM_ARCH_IO_H /* - * Virtual view <-> DMA view memory address translations - * virt_to_bus: Used to translate the virtual address to an - * address suitable to be passed to set_dma_addr - * bus_to_virt: Used to convert an address for DMA operations - * to an address that the kernel can use. - */ -#define virt_to_bus(x) ((unsigned long)(x)) -#define bus_to_virt(x) ((void *)(x)) - -/* * This architecture does not require any delayed IO, and * has the constant-optimised IO */ @@ -174,14 +164,7 @@ DECLARE_IO(long,l,"") }) #define __ioaddrc(port) \ -({ \ - unsigned long addr; \ - if (__PORT_PCIO((port))) \ - addr = PCIO_BASE + ((port) << 2); \ - else \ - addr = IO_BASE + ((port) << 2); \ - addr; \ -}) + (__PORT_PCIO((port)) ? PCIO_BASE + ((port) << 2) : IO_BASE + ((port) << 2)) /* * Translated address IO functions diff --git a/include/asm-arm/arch-rpc/irq.h b/include/asm-arm/arch-rpc/irq.h index 750f5c905..9ef1bacc7 100644 --- a/include/asm-arm/arch-rpc/irq.h +++ b/include/asm-arm/arch-rpc/irq.h @@ -131,8 +131,4 @@ static __inline__ void irq_init_irq(void) outb(0, IOMD_IRQMASKB); outb(0, IOMD_FIQMASK); outb(0, IOMD_DMAMASK); - outb(0, IOMD_IO0CR); - outb(0, IOMD_IO1CR); - outb(0, IOMD_IO2CR); - outb(0, IOMD_IO3CR); } diff --git a/include/asm-arm/arch-rpc/irqs.h b/include/asm-arm/arch-rpc/irqs.h index b7188fb8e..9adbc9c61 100644 --- a/include/asm-arm/arch-rpc/irqs.h +++ b/include/asm-arm/arch-rpc/irqs.h @@ -21,8 +21,17 @@ #define IRQ_KEYBOARDTX 14 #define IRQ_KEYBOARDRX 15 +#define IRQ_DMA0 16 +#define IRQ_DMA1 17 +#define IRQ_DMA2 18 +#define IRQ_DMA3 19 +#define IRQ_DMAS0 20 +#define IRQ_DMAS1 21 + #define FIQ_FLOPPYDATA 0 #define FIQ_ECONET 2 #define FIQ_SERIALPORT 4 #define FIQ_EXPANSIONCARD 6 #define FIQ_FORCE 7 + +#define IRQ_TIMER IRQ_TIMER0 diff --git a/include/asm-arm/arch-rpc/keyboard.h b/include/asm-arm/arch-rpc/keyboard.h new file mode 100644 index 000000000..60d3f0b8c --- /dev/null +++ b/include/asm-arm/arch-rpc/keyboard.h @@ -0,0 +1,38 @@ +/* + * linux/include/asm-arm/arch-rpc/keyboard.h + * + * Keyboard driver definitions for RiscPC architecture + * + * (C) 1998 Russell King + */ + +#include <asm/irq.h> + +#define NR_SCANCODES 128 + +extern int ps2kbd_pretranslate(unsigned char scancode); +extern int ps2kbd_translate(unsigned char scancode, unsigned char *keycode_p, char *up_flag_p); +extern void ps2kbd_leds(unsigned char leds); +extern void ps2kbd_init_hw(void); +extern unsigned char ps2kbd_sysrq_xlate[NR_SCANCODES]; + +#define kbd_setkeycode(sc,kc) (-EINVAL) +#define kbd_getkeycode(sc) (-EINVAL) + +/* Prototype: int kbd_pretranslate(scancode, raw_mode) + * Returns : 0 to ignore scancode + */ +#define kbd_pretranslate(sc,rm) ps2kbd_pretranslate(sc) + +/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) + * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag + * set to 0200 if scancode indicates release + */ +#define kbd_translate(sc, kcp, ufp, rm) ps2kbd_translate(sc, kcp, ufp) +#define kbd_unexpected_up(kc) (0200) +#define kbd_leds(leds) ps2kbd_leds(leds) +#define kbd_init_hw() ps2kbd_init_hw() +#define kbd_sysrq_xlate ps2kbd_sysrq_xlate +#define kbd_disable_irq() disable_irq(IRQ_KEYBOARDRX) +#define kbd_enable_irq() enable_irq(IRQ_KEYBOARDRX) + diff --git a/include/asm-arm/arch-rpc/mm-init.h b/include/asm-arm/arch-rpc/mm-init.h new file mode 100644 index 000000000..81de91a01 --- /dev/null +++ b/include/asm-arm/arch-rpc/mm-init.h @@ -0,0 +1,47 @@ +/* + * linux/include/asm-arm/arch-rpc/mmap.h + * + * Copyright (C) 1996 Russell King + */ + +#define HAVE_MAP_VID_MEM + +unsigned long map_screen_mem(unsigned long log_start, unsigned long kmem, int update) +{ + static int updated = 0; + unsigned long address; + pgd_t *pgd; + + if (updated) + return 0; + updated = update; + + address = SCREEN_START | PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) | PMD_SECT_AP_WRITE; + pgd = swapper_pg_dir + (SCREEN2_BASE >> PGDIR_SHIFT); + pgd_val(pgd[0]) = address; + pgd_val(pgd[1]) = address + (1 << PGDIR_SHIFT); + + if (update) { + unsigned long pgtable = PAGE_ALIGN(kmem), *p; + int i; + + memzero ((void *)pgtable, 4096); + + pgd_val(pgd[-2]) = __virt_to_phys(pgtable) | PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_KERNEL); + pgd_val(pgd[-1]) = __virt_to_phys(pgtable + PTRS_PER_PTE*4) | PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_KERNEL); + p = (unsigned long *)pgtable; + + i = PTRS_PER_PTE * 2 - ((SCREEN1_END - log_start) >> PAGE_SHIFT); + address = SCREEN_START | PTE_TYPE_SMALL | PTE_AP_WRITE; + + while (i < PTRS_PER_PTE * 2) { + p[i++] = address; + address += PAGE_SIZE; + } + + flush_page_to_ram(pgtable); + + kmem = pgtable + PAGE_SIZE; + } + return kmem; +} diff --git a/include/asm-arm/arch-rpc/mmu.h b/include/asm-arm/arch-rpc/mmu.h index fbd403d36..7fca09aaa 100644 --- a/include/asm-arm/arch-rpc/mmu.h +++ b/include/asm-arm/arch-rpc/mmu.h @@ -7,6 +7,7 @@ * 20-10-1996 RMK Created * 31-12-1997 RMK Fixed definitions to reduce warnings * 11-01-1998 RMK Uninlined to reduce hits on cache + * 08-02-1998 RMK Added __virt_to_bus and __bus_to_virt */ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H @@ -14,4 +15,13 @@ extern unsigned long __virt_to_phys(unsigned long vpage); extern unsigned long __phys_to_virt(unsigned long ppage); +/* + * These are exactly the same on the RiscPC as the + * physical memory view. + */ +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + #endif diff --git a/include/asm-arm/arch-rpc/processor.h b/include/asm-arm/arch-rpc/processor.h index d5c478737..61ab21538 100644 --- a/include/asm-arm/arch-rpc/processor.h +++ b/include/asm-arm/arch-rpc/processor.h @@ -29,6 +29,6 @@ #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) #define INIT_MMAP \ -{ &init_mm, 0xc0000000, 0xc2000000, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } #endif diff --git a/include/asm-arm/arch-rpc/uncompress.h b/include/asm-arm/arch-rpc/uncompress.h index de645f76d..577d18d1e 100644 --- a/include/asm-arm/arch-rpc/uncompress.h +++ b/include/asm-arm/arch-rpc/uncompress.h @@ -77,7 +77,7 @@ static void puts(const char *s) } } else { ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h); - ll_write_char(ptr, c|(white<<8)); + ll_write_char(ptr, c|(white<<16)); if ( ++x >= video_num_columns ) { x = 0; if ( ++y >= video_num_lines ) { diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h index 718fbb2b8..d8b9f1d3a 100644 --- a/include/asm-arm/dma.h +++ b/include/asm-arm/dma.h @@ -1,28 +1,105 @@ #ifndef __ASM_ARM_DMA_H #define __ASM_ARM_DMA_H -#include <asm/irq.h> +typedef unsigned int dmach_t; -#define MAX_DMA_CHANNELS 14 -#define DMA_0 8 -#define DMA_1 9 -#define DMA_2 10 -#define DMA_3 11 -#define DMA_S0 12 -#define DMA_S1 13 +#include <asm/irq.h> +#include <asm/arch/dma.h> -#define DMA_MODE_READ 0x44 -#define DMA_MODE_WRITE 0x48 +typedef struct { + unsigned long address; + unsigned long length; +} dmasg_t; extern const char dma_str[]; -#include <asm/arch/dma.h> +/* Clear the 'DMA Pointer Flip Flop'. + * Write 0 for LSB/MSB, 1 for MSB/LSB access. + * + * NOTE: This is an architecture specific function, and should + * be hidden from the drivers. + */ +#define clear_dma_ff(channel) -/* These are in kernel/dma.c: */ -/* reserve a DMA channel */ -extern int request_dma(unsigned int dmanr, const char * device_id); -/* release it again */ -extern void free_dma(unsigned int dmanr); +/* Set only the page register bits of the transfer address. + * + * NOTE: This is an architecture specific function, and should + * be hidden from the drivers + */ +static __inline__ void set_dma_page(dmach_t channel, char pagenr) +{ + printk(dma_str, "set_dma_page", channel); +} -#endif /* _ARM_DMA_H */ +/* Request a DMA channel + * + * Some architectures may need to do allocate an interrupt + */ +extern int request_dma(dmach_t channel, const char * device_id); + +/* Free a DMA channel + * + * Some architectures may need to do free an interrupt + */ +extern void free_dma(dmach_t channel); + +/* Enable DMA for this channel + * + * On some architectures, this may have other side effects like + * enabling an interrupt and setting the DMA registers. + */ +extern void enable_dma(dmach_t channel); + +/* Disable DMA for this channel + * + * On some architectures, this may have other side effects like + * disabling an interrupt or whatever. + */ +extern void disable_dma(dmach_t channel); +/* Set the DMA scatter gather list for this channel + * + * This should not be called if a DMA channel is enabled, + * especially since some DMA architectures don't update the + * DMA address immediately, but defer it to the enable_dma(). + */ +extern void set_dma_sg(dmach_t channel, dmasg_t *sg, int nr_sg); + +/* Set the DMA address for this channel + * + * This should not be called if a DMA channel is enabled, + * especially since some DMA architectures don't update the + * DMA address immediately, but defer it to the enable_dma(). + */ +extern void set_dma_addr(dmach_t channel, unsigned long physaddr); + +/* Set the DMA byte count for this channel + * + * This should not be called if a DMA channel is enabled, + * especially since some DMA architectures don't update the + * DMA count immediately, but defer it to the enable_dma(). + */ +extern void set_dma_count(dmach_t channel, unsigned long count); + +/* Set the transfer direction for this channel + * + * This should not be called if a DMA channel is enabled, + * especially since some DMA architectures don't update the + * DMA transfer direction immediately, but defer it to the + * enable_dma(). + */ +extern void set_dma_mode(dmach_t channel, dmamode_t mode); + +/* Get DMA residue count. After a DMA transfer, this + * should return zero. Reading this while a DMA transfer is + * still in progress will return unpredictable results. + * If called before the channel has been used, it may return 1. + * Otherwise, it returns the number of _bytes_ left to transfer. + */ +extern int get_dma_residue(dmach_t channel); + +#ifndef NO_DMA +#define NO_DMA 255 +#endif + +#endif /* _ARM_DMA_H */ diff --git a/include/asm-arm/ecard.h b/include/asm-arm/ecard.h index 3ca8cf1fb..fed84980d 100644 --- a/include/asm-arm/ecard.h +++ b/include/asm-arm/ecard.h @@ -16,7 +16,8 @@ #define __ASM_ECARD_H /* - * Currently understood cards + * Currently understood cards (but not necessarily + * supported): * Manufacturer Product ID */ #define MANU_ACORN 0x0000 @@ -60,6 +61,8 @@ #define MANU_MCS 0x0063 #define PROD_MCS_CONNECT32 0x0125 +#define MANU_EESOX 0x0064 +#define PROD_EESOX_SCSI2 0x008c #ifdef ECARD_C @@ -72,8 +75,9 @@ /* Type of card's address space */ typedef enum { - ECARD_IOC = 0, - ECARD_MEMC = 1 + ECARD_IOC, + ECARD_MEMC, + ECARD_DEBI } card_type_t; /* Speed of card for ECARD_IOC address space */ @@ -124,10 +128,12 @@ struct expansion_card { unsigned char irqmask; /* IRQ mask */ unsigned char fiqmask; /* FIQ mask */ unsigned char claimed; /* Card claimed? */ + CONST unsigned char slot_no; /* Slot number */ + CONST unsigned char dma; /* DMA number (for request_dma) */ CONST unsigned char irq; /* IRQ number (for request_irq) */ CONST unsigned char fiq; /* FIQ number (for request_irq) */ - CONST unsigned short unused; + CONST struct in_ecld cld; /* Card Identification */ void *irq_data; /* Data for use for IRQ by card */ void *fiq_data; /* Data for use for FIQ by card */ diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index cf49fbfa1..139481831 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h @@ -38,6 +38,23 @@ typedef struct { void *null; } elf_fpregset_t; #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) +/* This yields a mask that user programs can use to figure out what + instruction set this cpu supports. This could be done in userspace, + but it's not easy, and we've already done it here. */ + +#define ELF_HWCAP (0) + +/* This yields a string that ld.so will use to load implementation + specific libraries for optimization. This is more specific in + intent than poking at uname or /proc/cpuinfo. */ + +#define ELF_PLATFORM (NULL) + +#ifdef __KERNEL__ +#define SET_PERSONALITY(ex,ibcs2) \ + current->personality = PER_LINUX_32BIT +#endif + #define R_ARM_NONE (0) #define R_ARM_32 (1) /* => ld 32 */ #define R_ARM_PC26 (2) /* => ld b/bl branches */ diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h index 0e38fc890..bd25d1838 100644 --- a/include/asm-arm/hardirq.h +++ b/include/asm-arm/hardirq.h @@ -4,7 +4,6 @@ #include <linux/tasks.h> extern unsigned int local_irq_count[NR_CPUS]; -#define in_interrupt() (local_irq_count[smp_processor_id()] != 0) #ifndef __SMP__ diff --git a/include/asm-arm/hardware.h b/include/asm-arm/hardware.h index 6b3cbfaba..c21abeed3 100644 --- a/include/asm-arm/hardware.h +++ b/include/asm-arm/hardware.h @@ -140,6 +140,11 @@ do { \ #define IOMD_ECTCR __IOMD(0x0C8) #define IOMD_DMAEXT __IOMD(0x0CC) +#define DMA_EXT_IO0 1 +#define DMA_EXT_IO1 2 +#define DMA_EXT_IO2 4 +#define DMA_EXT_IO3 8 + #define IOMD_IO0CURA __IOMD(0x100) #define IOMD_IO0ENDA __IOMD(0x104) #define IOMD_IO0CURB __IOMD(0x108) @@ -195,6 +200,9 @@ do { \ #define IOMD_DMAREQ __IOMD(0x1F4) #define IOMD_DMAMASK __IOMD(0x1F8) +#define DMA_END_S (1 << 31) +#define DMA_END_L (1 << 30) + #define DMA_CR_C 0x80 #define DMA_CR_D 0x40 #define DMA_CR_E 0x20 diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 8703c920a..2451663e3 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -17,12 +17,22 @@ #include <asm/arch/io.h> /* unsigned long virt_to_phys(void *x) */ -#define virt_to_phys(x) __virt_to_phys((unsigned long)(x)) +#define virt_to_phys(x) (__virt_to_phys((unsigned long)(x))) /* void *phys_to_virt(unsigned long x) */ #define phys_to_virt(x) ((void *)(__phys_to_virt((unsigned long)(x)))) /* + * Virtual view <-> DMA view memory address translations + * virt_to_bus: Used to translate the virtual address to an + * address suitable to be passed to set_dma_addr + * bus_to_virt: Used to convert an address for DMA operations + * to an address that the kernel can use. + */ +#define virt_to_bus(x) (__virt_to_bus((unsigned long)(x))) +#define bus_to_virt(x) ((void *)(__bus_to_virt(x))) + +/* * These macros actually build the multi-value IO function prototypes */ #define __OUTS(s,i,x) extern void outs##s(unsigned int port, const void *from, int len); diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h index f7a7a8934..99b949ddb 100644 --- a/include/asm-arm/irq.h +++ b/include/asm-arm/irq.h @@ -1,7 +1,19 @@ #ifndef __ASM_ARM_IRQ_H #define __ASM_ARM_IRQ_H -#include <asm/irq-no.h> +#include <asm/arch/irqs.h> + +#ifndef NR_IRQS +#define NR_IRQS 128 +#endif + +/* + * Use this value to indicate lack of interrupt + * capability + */ +#ifndef NO_IRQ +#define NO_IRQ 255 +#endif extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); diff --git a/include/asm-arm/keyboard.h b/include/asm-arm/keyboard.h new file mode 100644 index 000000000..6b64ec6af --- /dev/null +++ b/include/asm-arm/keyboard.h @@ -0,0 +1,26 @@ +/* + * linux/include/asm-arm/keyboard.h + * + * Keyboard driver definitions for ARM + * + * (C) 1998 Russell King + */ +#ifndef __ASM_ARM_KEYBOARD_H +#define __ASM_ARM_KEYBOARD_H + +/* + * We provide a unified keyboard interface when in VC_MEDIUMRAW + * mode. This means that all keycodes must be common between + * all supported keyboards. This unfortunately puts us at odds + * with the PC keyboard interface chip... but we can't do anything + * about that now. + */ +#ifdef __KERNEL__ + +#include <asm/arch/keyboard.h> + +#define SYSRQ_KEY 13 + +#endif /* __KERNEL__ */ + +#endif /* __ASM_ARM_KEYBOARD_H */ diff --git a/include/asm-arm/leds.h b/include/asm-arm/leds.h new file mode 100644 index 000000000..d253e2abf --- /dev/null +++ b/include/asm-arm/leds.h @@ -0,0 +1,20 @@ +/* + * include/asm-arm/leds.h + * + * Copyright (C) 1998 Russell King + * + * Event-driven interface for LEDs on machines + */ +#ifndef ASM_ARM_LEDS_H +#define ASM_ARM_LEDS_H + +typedef enum { + led_idle_start, + led_idle_end, + led_timer +} led_event_t; + +/* Use this routine to handle LEDs */ +extern void leds_event(led_event_t); + +#endif diff --git a/include/asm-arm/proc-armo/pgtable.h b/include/asm-arm/proc-armo/pgtable.h index 3fdb824e7..1f27878ef 100644 --- a/include/asm-arm/proc-armo/pgtable.h +++ b/include/asm-arm/proc-armo/pgtable.h @@ -9,6 +9,7 @@ #include <asm/arch/mmu.h> #include <linux/slab.h> +#include <asm/arch/processor.h> /* For TASK_SIZE */ #define LIBRARY_TEXT_START 0x0c000000 @@ -116,6 +117,7 @@ extern __inline__ void update_mm_cache_mm_addr(struct mm_struct *mm, unsigned lo #define PTRS_PER_PTE 32 #define PTRS_PER_PMD 1 #define PTRS_PER_PGD 32 +#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SHIFT) /* Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the @@ -321,43 +323,111 @@ extern __inline__ pte_t * pte_offset(pmd_t *dir, unsigned long address) * used to allocate a kernel page table - this turns on ASN bits * if any. */ -#define pte_free_kernel(pte) pte_free((pte)) -#define pte_alloc_kernel(pmd,address) pte_alloc((pmd),(address)) -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -#define pmd_free_kernel(pmdp) -#define pmd_alloc_kernel(pgd,address) ((pmd_t *)(pgd)) +#ifndef __SMP__ +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; + +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgd_quicklist (quicklists.pgd_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) + +#else +#error Pgtable caches have to be per-CPU, so that no locking is needed. +#endif -extern __inline__ void pte_free(pte_t * pte) +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]; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) { - kfree (pte); + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; } -extern const char bad_pmd_string[]; +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + kfree(pgd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + kfree(pte); +} + +/* We don't use pmd cache, so this is a dummy routine */ +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ +} + +extern void __bad_pte(pmd_t *pmd); + +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) { address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); if (pmd_none (*pmd)) { - pte_t *page = (pte_t *) kmalloc (PTRS_PER_PTE * BYTES_PER_PTR, GFP_KERNEL); - if (pmd_none (*pmd)) { - if (page) { - memzero (page, PTRS_PER_PTE * BYTES_PER_PTR); - set_pmd(pmd, mk_pmd(page)); - return page + address; - } - set_pmd (pmd, mk_pmd (BAD_PAGETABLE)); - return NULL; - } - kfree (page); + pte_t *page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + set_pmd(pmd, mk_pmd(page)); + return page + address; } if (pmd_bad (*pmd)) { - printk(bad_pmd_string, pmd_val(*pmd)); - set_pmd (pmd, mk_pmd (BAD_PAGETABLE)); + __bad_pte(pmd); return NULL; } return (pte_t *) pmd_page(*pmd) + address; @@ -367,28 +437,33 @@ extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) * allocating and freeing a pmd is trivial: the 1-entry pmd is * inside the pgd, so has no extra memory associated with it. */ -#define pmd_free(pmd) -#define pmd_alloc(pgd,address) ((pmd_t *)(pgd)) +extern __inline__ void pmd_free(pmd_t *pmd) +{ +} -/* - * Free a page directory. Takes the virtual address. - */ -extern __inline__ void pgd_free(pgd_t * pgd) +extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) { - kfree ((void *)pgd); + return (pmd_t *) pgd; } -/* - * Allocate a new page directory. Return the virtual address of it. - */ -extern __inline__ pgd_t * pgd_alloc(void) +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc +#define pte_alloc_kernel pte_alloc + +extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) { + struct task_struct * p; pgd_t *pgd; - - pgd = (pgd_t *) kmalloc(PTRS_PER_PGD * BYTES_PER_PTR, GFP_KERNEL); - if (pgd) - memzero (pgd, PTRS_PER_PGD * BYTES_PER_PTR); - return 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]; diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h index 0da437ff7..f76b404c5 100644 --- a/include/asm-arm/proc-armo/processor.h +++ b/include/asm-arm/proc-armo/processor.h @@ -113,6 +113,15 @@ extern __inline__ void copy_thread_css (struct context_save_struct *save) flush_tlb_mm(current->mm); \ }) +/* Allocation and freeing of basic task resources. */ +/* + * NOTE! The task struct and the stack go together + */ +#define alloc_task_struct() \ + ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) +#define free_task_struct(p) free_pages((unsigned long)(p),1) + + #endif #endif diff --git a/include/asm-arm/proc-armv/mm-init.h b/include/asm-arm/proc-armv/mm-init.h index 0ffb05a16..287779258 100644 --- a/include/asm-arm/proc-armv/mm-init.h +++ b/include/asm-arm/proc-armv/mm-init.h @@ -35,76 +35,120 @@ * * We set it up using the section page table entries. */ - -#include <asm/arch/mmap.h> #include <asm/pgtable.h> -#define V2P(x) virt_to_phys(x) #define PTE_SIZE (PTRS_PER_PTE * 4) -#define PMD_SECT (PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) | PMD_SECT_CACHEABLE) +extern unsigned long setup_io_pagetables(unsigned long start_mem); -static inline void setup_swapper_dir (int index, unsigned long entry) +/* + * Add a SECTION mapping between VIRT and PHYS in domain DOMAIN with protection PROT + */ +static inline void +alloc_init_section(unsigned long *mem, unsigned long virt, unsigned long phys, int domain, int prot) { - pmd_t pmd; + pgd_t *pgdp; + pmd_t *pmdp; - pmd_val(pmd) = entry; - set_pmd (pmd_offset (swapper_pg_dir + index, 0), pmd); + pgdp = pgd_offset_k(virt); + pmdp = pmd_offset(pgdp, virt); + + pmd_val(*pmdp) = phys | PMD_TYPE_SECT | PMD_DOMAIN(domain) | prot; } -static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem) +/* + * Clear any mapping + */ +static inline void +free_init_section(unsigned long virt) { - unsigned long address; - unsigned int spi; - union { unsigned long l; unsigned long *p; } u; - - /* map in zero page */ - u.l = ((start_mem + (PTE_SIZE-1)) & ~(PTE_SIZE-1)); - start_mem = u.l + PTE_SIZE; - memzero (u.p, PTE_SIZE); - *u.p = V2P(PAGE_OFFSET) | PTE_CACHEABLE | PTE_TYPE_SMALL; - setup_swapper_dir (0, V2P(u.l) | PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_USER)); - - for (spi = 1; spi < (PAGE_OFFSET >> PGDIR_SHIFT); spi++) - pgd_val(swapper_pg_dir[spi]) = 0; - - /* map in physical ram & kernel */ - address = PAGE_OFFSET; - while (spi < end_mem >> PGDIR_SHIFT) { - setup_swapper_dir (spi++, - V2P(address) | PMD_SECT | - PMD_SECT_BUFFERABLE | PMD_SECT_AP_WRITE); - address += PGDIR_SIZE; + pgd_t *pgdp; + pmd_t *pmdp; + + pgdp = pgd_offset_k(virt); + pmdp = pmd_offset(pgdp, virt); + + pmd_clear(pmdp); +} + +/* + * Add a PAGE mapping between VIRT and PHYS in domain DOMAIN with protection PROT + */ +static inline void +alloc_init_page(unsigned long *mem, unsigned long virt, unsigned long phys, int domain, int prot) +{ + pgd_t *pgdp; + pmd_t *pmdp; + pte_t *ptep; + + pgdp = pgd_offset_k(virt); + pmdp = pmd_offset(pgdp, virt); + + if (pmd_none(*pmdp)) { + unsigned long memory = *mem; + + memory = (memory + PTE_SIZE - 1) & ~(PTE_SIZE - 1); + + ptep = (pte_t *)memory; + memzero(ptep, PTE_SIZE); + + pmd_val(*pmdp) = __virt_to_phys(memory) | PMD_TYPE_TABLE | PMD_DOMAIN(domain); + + *mem = memory + PTE_SIZE; } - while (spi < PTRS_PER_PGD) - pgd_val(swapper_pg_dir[spi++]) = 0; + + ptep = pte_offset(pmdp, virt); + + pte_val(*ptep) = phys | prot | PTE_TYPE_SMALL; +} + +static inline unsigned long +setup_pagetables(unsigned long start_mem, unsigned long end_mem) +{ + unsigned long address; + + /* + * map in zero page + */ + alloc_init_page(&start_mem, 0, __virt_to_phys(PAGE_OFFSET), DOMAIN_USER, PTE_CACHEABLE); + + /* + * ensure no mappings in user space + */ + for (address = PGDIR_SIZE; address < PAGE_OFFSET; address += PGDIR_SIZE) + free_init_section(address); + + /* + * map in physical ram & kernel + */ + for (address = PAGE_OFFSET; address < end_mem; address += PGDIR_SIZE) + alloc_init_section(&start_mem, address, __virt_to_phys(address), DOMAIN_KERNEL, + PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE | PMD_SECT_AP_WRITE); + + /* + * unmap everything else + */ + for (address = end_mem; address; address += PGDIR_SIZE) + free_init_section(address); /* * An area to invalidate the cache */ - setup_swapper_dir (0xdf0, SAFE_ADDR | PMD_SECT | PMD_SECT_AP_READ); - - /* map in IO */ - address = IO_START; - spi = IO_BASE >> PGDIR_SHIFT; - pgd_val(swapper_pg_dir[spi-1]) = 0xc0000000 | PMD_TYPE_SECT | - PMD_DOMAIN(DOMAIN_KERNEL) | PMD_SECT_AP_WRITE; - while (address < IO_START + IO_SIZE && address) { - pgd_val(swapper_pg_dir[spi++]) = address | - PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_IO) | - PMD_SECT_AP_WRITE; - address += PGDIR_SIZE; - } + alloc_init_section(&start_mem, 0xdf000000, SAFE_ADDR, DOMAIN_KERNEL, + PMD_SECT_CACHEABLE | PMD_SECT_AP_READ); -#ifdef HAVE_MAP_VID_MEM - map_screen_mem(0, 0, 0); -#endif + /* + * Now set up our IO mappings + */ + start_mem = setup_io_pagetables(start_mem); flush_cache_all(); + return start_mem; } -static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) +static inline +void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem) { unsigned long smem; diff --git a/include/asm-arm/proc-armv/pgtable.h b/include/asm-arm/proc-armv/pgtable.h index 5816b2698..288e4043a 100644 --- a/include/asm-arm/proc-armv/pgtable.h +++ b/include/asm-arm/proc-armv/pgtable.h @@ -10,6 +10,7 @@ #define __ASM_PROC_PGTABLE_H #include <asm/arch/mmu.h> +#include <asm/arch/processor.h> /* For TASK_SIZE */ #define LIBRARY_TEXT_START 0x0c000000 @@ -132,6 +133,7 @@ #define PTRS_PER_PTE 256 #define PTRS_PER_PMD 1 #define PTRS_PER_PGD 4096 +#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) /* Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the @@ -176,17 +178,29 @@ /* * We define the bits in the page tables as follows: - * PTE_BUFFERABLE page is dirty - * PTE_AP_WRITE page is writable + * PTE_BUFFERABLE page is writable + * PTE_AP_WRITE page is dirty * PTE_AP_READ page is a young (unsetting this causes faults for any access) * * Any page that is mapped in is assumed to be readable... */ -#define PAGE_NONE __pgprot(PTE_TYPE_SMALL) -#define PAGE_SHARED __pgprot(PTE_TYPE_SMALL | PTE_CACHEABLE | PTE_AP_READ | PTE_AP_WRITE) -#define PAGE_COPY __pgprot(PTE_TYPE_SMALL | PTE_CACHEABLE | PTE_AP_READ) -#define PAGE_READONLY __pgprot(PTE_TYPE_SMALL | PTE_CACHEABLE | PTE_AP_READ) -#define PAGE_KERNEL __pgprot(PTE_TYPE_SMALL | PTE_CACHEABLE | PTE_BUFFERABLE | PTE_AP_WRITE) +#if 0 +#define _PTE_YOUNG PTE_AP_READ +#define _PTE_DIRTY PTE_AP_WRITE +#define _PTE_READ PTE_CACHEABLE +#define _PTE_WRITE PTE_BUFFERABLE +#else +#define _PTE_YOUNG PTE_CACHEABLE +#define _PTE_DIRTY PTE_BUFFERABLE +#define _PTE_READ PTE_AP_READ +#define _PTE_WRITE PTE_AP_WRITE +#endif + +#define PAGE_NONE __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG) +#define PAGE_SHARED __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG | _PTE_READ | _PTE_WRITE) +#define PAGE_COPY __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG | _PTE_READ) +#define PAGE_READONLY __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG | _PTE_READ) +#define PAGE_KERNEL __pgprot(PTE_TYPE_SMALL | _PTE_YOUNG | _PTE_DIRTY | _PTE_WRITE) #define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_USER)) #define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_KERNEL)) @@ -247,7 +261,7 @@ extern unsigned long *empty_zero_page; /* to set the page-dir */ #define SET_PAGE_DIR(tsk,pgdir) \ do { \ - tsk->tss.memmap = __virt_to_phys(pgdir); \ + tsk->tss.memmap = __virt_to_phys((unsigned long)pgdir); \ if ((tsk) == current) \ __asm__ __volatile__( \ "mcr%? p15, 0, %0, c2, c0, 0\n" \ @@ -263,6 +277,9 @@ extern __inline__ int pte_none(pte_t pte) extern __inline__ int pte_present(pte_t pte) { +#if 0 + /* This is what it really does, the else + part is just to make it easier for the compiler */ switch (pte_val(pte) & PTE_TYPE_MASK) { case PTE_TYPE_LARGE: case PTE_TYPE_SMALL: @@ -270,6 +287,9 @@ extern __inline__ int pte_present(pte_t pte) default: return 0; } +#else + return ((pte_val(pte) + 1) & 2); +#endif } extern __inline__ int pmd_none(pmd_t pmd) @@ -281,6 +301,9 @@ extern __inline__ int pmd_none(pmd_t pmd) extern __inline__ int pmd_bad(pmd_t pmd) { +#if 0 + /* This is what it really does, the else + part is just to make it easier for the compiler */ switch (pmd_val(pmd) & PMD_TYPE_MASK) { case PMD_TYPE_FAULT: case PMD_TYPE_TABLE: @@ -288,16 +311,25 @@ extern __inline__ int pmd_bad(pmd_t pmd) default: return 1; } +#else + return pmd_val(pmd) & 2; +#endif } extern __inline__ int pmd_present(pmd_t pmd) { +#if 0 + /* This is what it really does, the else + part is just to make it easier for the compiler */ switch (pmd_val(pmd) & PMD_TYPE_MASK) { case PMD_TYPE_TABLE: return 1; default: return 0; } +#else + return ((pmd_val(pmd) + 1) & 2); +#endif } /* @@ -322,19 +354,14 @@ extern __inline__ int pte_write(pte_t pte) return pte_val(pte) & PTE_AP_WRITE; } -extern __inline__ int pte_cacheable(pte_t pte) -{ - return pte_val(pte) & PTE_CACHEABLE; -} - extern __inline__ int pte_dirty(pte_t pte) { - return pte_val(pte) & PTE_BUFFERABLE; + return pte_val(pte) & _PTE_DIRTY; } extern __inline__ int pte_young(pte_t pte) { - return pte_val(pte) & PTE_AP_READ; + return pte_val(pte) & _PTE_YOUNG; } extern __inline__ pte_t pte_wrprotect(pte_t pte) @@ -441,7 +468,7 @@ extern __inline__ void set_pte(pte_t *pteptr, pte_t pteval) extern __inline__ unsigned long pte_page(pte_t pte) { - return (unsigned long)phys_to_virt(pte_val(pte) & PAGE_MASK); + return __phys_to_virt(pte_val(pte) & PAGE_MASK); } extern __inline__ pmd_t mk_user_pmd(pte_t *ptep) @@ -470,7 +497,7 @@ extern __inline__ void set_pmd(pmd_t *pmdp, pmd_t pmd) extern __inline__ unsigned long pmd_page(pmd_t pmd) { - return (unsigned long)phys_to_virt(pmd_val(pmd) & 0xfffffc00); + return __phys_to_virt(pmd_val(pmd) & 0xfffffc00); } /* to find an entry in a kernel page-table-directory */ @@ -479,7 +506,7 @@ extern __inline__ unsigned long pmd_page(pmd_t pmd) /* 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); + return mm->pgd + (address >> PGDIR_SHIFT); } /* Find an entry in the second-level page table.. */ @@ -488,7 +515,7 @@ extern __inline__ pgd_t * pgd_offset(struct mm_struct * mm, unsigned long addres /* Find an entry in the third-level page table.. */ extern __inline__ pte_t * pte_offset(pmd_t * dir, unsigned long address) { - return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); + return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); } extern unsigned long get_small_page(int priority); @@ -499,69 +526,130 @@ extern void free_small_page(unsigned long page); * used to allocate a kernel page table - this turns on ASN bits * if any. */ -extern __inline__ void pte_free_kernel(pte_t * pte) + +#ifndef __SMP__ +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; + +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) +#else +#error Pgtable caches have to be per-CPU, so that no locking is needed. +#endif + +extern pgd_t *get_pgd_slow(void); + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +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_small_page((unsigned long) pte); + free_pages((unsigned long) pgd, 2); } -extern const char bad_pmd_string[]; +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); +extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_small_page((unsigned long)pte); +} + +/* We don't use pmd cache, so this is a dummy routine */ +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ +} + +extern void __bad_pmd(pmd_t *pmd); +extern void __bad_pmd_kernel(pmd_t *pmd); + +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() extern __inline__ pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) { address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_small_page(GFP_KERNEL); - if (pmd_none(*pmd)) { - if (page) { - memzero (page, PTRS_PER_PTE * BYTES_PER_PTR); - set_pmd(pmd, mk_kernel_pmd(page)); - return page + address; - } - set_pmd(pmd, mk_kernel_pmd(BAD_PAGETABLE)); - return NULL; - } - free_small_page((unsigned long) page); + pte_t *page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_kernel_slow(pmd, address); + set_pmd(pmd, mk_kernel_pmd(page)); + return page + address; } if (pmd_bad(*pmd)) { - printk(bad_pmd_string, pmd_val(*pmd)); - set_pmd(pmd, mk_kernel_pmd(BAD_PAGETABLE)); + __bad_pmd_kernel(pmd); return NULL; } return (pte_t *) pmd_page(*pmd) + address; } -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -#define pmd_free_kernel(pmdp) pmd_val(*(pmdp)) = 0; -#define pmd_alloc_kernel(pgdp, address) ((pmd_t *)(pgdp)) - -extern __inline__ void pte_free(pte_t * pte) -{ - free_small_page((unsigned long) pte); -} - extern __inline__ pte_t * pte_alloc(pmd_t * pmd, unsigned long address) { address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_small_page(GFP_KERNEL); - if (pmd_none(*pmd)) { - if (page) { - memzero (page, PTRS_PER_PTE * BYTES_PER_PTR); - set_pmd(pmd, mk_user_pmd(page)); - return page + address; - } - set_pmd(pmd, mk_user_pmd(BAD_PAGETABLE)); - return NULL; - } - free_small_page ((unsigned long) page); + pte_t *page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + set_pmd(pmd, mk_user_pmd(page)); + return page + address; } if (pmd_bad(*pmd)) { - printk(bad_pmd_string, pmd_val(*pmd)); - set_pmd(pmd, mk_user_pmd(BAD_PAGETABLE)); + __bad_pmd(pmd); return NULL; } return (pte_t *) pmd_page(*pmd) + address; @@ -571,32 +659,35 @@ extern __inline__ pte_t * pte_alloc(pmd_t * pmd, unsigned long address) * allocating and freeing a pmd is trivial: the 1-entry pmd is * inside the pgd, so has no extra memory associated with it. */ -#define pmd_free(pmdp) pmd_val(*(pmdp)) = 0; -#define pmd_alloc(pgdp, address) ((pmd_t *)(pgdp)) +extern __inline__ void pmd_free(pmd_t *pmd) +{ +} -/* - * Free a page directory. Takes the virtual address. - */ -extern __inline__ void pgd_free(pgd_t * pgd) +extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) { - free_pages((unsigned long) pgd, 2); + return (pmd_t *) pgd; } -/* - * Allocate a new page directory. Return the virtual address of it. - */ -extern __inline__ pgd_t * pgd_alloc(void) +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc + +#if 0 +extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) { - unsigned long pgd; + struct task_struct * p; + pgd_t *pgd; - /* - * need to get a 16k page for level 1 - */ - pgd = __get_free_pages(GFP_KERNEL,2,0); - if (pgd) - memzero ((void *)pgd, PTRS_PER_PGD * BYTES_PER_PTR); - return (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; } +#endif extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; @@ -614,4 +705,3 @@ extern __inline__ void update_mmu_cache(struct vm_area_struct * vma, #define SWP_ENTRY(type,offset) (((type) << 2) | ((offset) << 9)) #endif /* __ASM_PROC_PAGE_H */ - diff --git a/include/asm-arm/proc-armv/processor.h b/include/asm-arm/proc-armv/processor.h index cc2be2ceb..294dead68 100644 --- a/include/asm-arm/proc-armv/processor.h +++ b/include/asm-arm/proc-armv/processor.h @@ -82,7 +82,10 @@ extern __inline__ void copy_thread_css (struct context_save_struct *save) unsigned long *stack = (unsigned long *)sp; \ set_fs(USER_DS); \ memzero(regs->uregs, sizeof(regs->uregs)); \ - regs->ARM_cpsr = sp <= 0x04000000 ? USR26_MODE : USR_MODE; \ + if (current->personality == PER_LINUX_32BIT) \ + regs->ARM_cpsr = USR_MODE; \ + else \ + regs->ARM_cpsr = USR26_MODE; \ regs->ARM_pc = pc; /* pc */ \ regs->ARM_sp = sp; /* sp */ \ regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ @@ -95,7 +98,7 @@ extern __inline__ void copy_thread_css (struct context_save_struct *save) * NOTE! The task struct and the stack go together */ #define alloc_task_struct() \ - ((struct task_struct *) __get_free_pages(GFP_KERNEL,1,0)) + ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) #define free_task_struct(p) free_pages((unsigned long)(p),1) #endif diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index 6a1f38de0..0ef12de11 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -33,16 +33,13 @@ extern __inline__ void proc_hard_reset(void) /* * We can wait for an interrupt... */ -#if 0 #define proc_idle() \ do { \ __asm__ __volatile__( \ " mcr p15, 0, %0, c15, c8, 2" \ : : "r" (0)); \ } while (0) -#else -#define proc_idle() -#endif + /* * A couple of speedups for the ARM */ diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index 888933936..adcc91c05 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h @@ -3,5 +3,10 @@ #ifdef __SMP__ #error SMP not supported +#else + +#define cpu_logical_map(cpu) (cpu) + #endif + #endif diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h index 312aef936..91de70e6e 100644 --- a/include/asm-arm/socket.h +++ b/include/asm-arm/socket.h @@ -28,6 +28,11 @@ #define SO_RCVTIMEO 20 #define SO_SNDTIMEO 21 +/* Security levels - as per NRL IPv6 - don't actually do anything */ +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + #define SO_BINDTODEVICE 25 #endif /* _ASM_SOCKET_H */ diff --git a/include/asm-arm/softirq.h b/include/asm-arm/softirq.h index a9208b421..ba99f96f6 100644 --- a/include/asm-arm/softirq.h +++ b/include/asm-arm/softirq.h @@ -4,6 +4,9 @@ #include <asm/atomic.h> #include <asm/hardirq.h> +extern unsigned int local_bh_count[NR_CPUS]; +#define in_bh() (local_bh_count[smp_processor_id()] != 0) + #define get_active_bhs() (bh_mask & bh_active) #define clear_active_bhs(x) atomic_clear_mask((int)(x),&bh_active) @@ -25,44 +28,44 @@ extern inline void mark_bh(int nr) set_bit(nr, &bh_active); } -/* - * These use a mask count to correctly handle - * nested disable/enable calls - */ -extern inline void disable_bh(int nr) -{ - bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; -} - -extern inline void enable_bh(int nr) -{ - if (!--bh_mask_count[nr]) - bh_mask |= 1 << nr; -} - #ifdef __SMP__ #error SMP not supported #else -extern int __arm_bh_counter; - extern inline void start_bh_atomic(void) { - __arm_bh_counter++; + local_bh_count[smp_processor_id()]++; barrier(); } extern inline void end_bh_atomic(void) { barrier(); - __arm_bh_counter--; + local_bh_count[smp_processor_id()]--; } /* These are for the irq's testing the lock */ -#define softirq_trylock() (__arm_bh_counter ? 0 : (__arm_bh_counter=1)) -#define softirq_endlock() (__arm_bh_counter = 0) +#define softirq_trylock(cpu) (in_bh() ? 0 : (local_bh_count[smp_processor_id()]=1)) +#define softirq_endlock(cpu) (local_bh_count[smp_processor_id()] = 0) +#define synchronize_bh() do { } while (0) #endif /* SMP */ +/* + * These use a mask count to correctly handle + * nested disable/enable calls + */ +extern inline void disable_bh(int nr) +{ + bh_mask &= ~(1 << nr); + bh_mask_count[nr]++; + synchronize_bh(); +} + +extern inline void enable_bh(int nr) +{ + if (!--bh_mask_count[nr]) + bh_mask |= 1 << nr; +} + #endif /* __ASM_SOFTIRQ_H */ diff --git a/include/asm-arm/stat.h b/include/asm-arm/stat.h index 76c20e28f..924fabca8 100644 --- a/include/asm-arm/stat.h +++ b/include/asm-arm/stat.h @@ -38,4 +38,40 @@ struct stat { unsigned long __unused5; }; +typedef struct { + unsigned int minor; + unsigned int major; +} __new_dev_t; + +struct stat64 { + __new_dev_t st_dev; + __u64 st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + __new_dev_t st_rdev; + __s64 st_size; + __u64 st_blocks; + unsigned long st_atime; + unsigned long __unused1; + unsigned long st_mtime; + unsigned long __unused2; + unsigned long st_ctime; + unsigned long __unused3; + unsigned long st_blksize; + unsigned long __unused4; +}; + +#define __XSTAT_VER_1 1 +#define __XSTAT_VER_2 2 +#define __XSTAT_VER_MASK 0xff + +#define __XSTAT_VER_XSTAT 0x000 +#define __XSTAT_VER_LXSTAT 0x100 +#define __XSTAT_VER_FXSTAT 0x200 +#define __XSTAT_VER_TYPEMASK 0xff00 + +#define __XMKNOD_VER_1 1 + #endif diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h index 9ad62d154..4a74e20cb 100644 --- a/include/asm-arm/termios.h +++ b/include/asm-arm/termios.h @@ -54,6 +54,7 @@ struct termio { #define N_STRIP 4 #define N_AX25 5 #define N_X25 6 /* X.25 async */ +#define N_6PACK 7 #ifdef __KERNEL__ diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h index 38ea29855..a1e76285a 100644 --- a/include/asm-arm/types.h +++ b/include/asm-arm/types.h @@ -39,6 +39,8 @@ typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; +#define BITS_PER_LONG 32 + #endif /* __KERNEL__ */ #endif diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 9bcf62793..5ec2e008d 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -189,6 +189,8 @@ #define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179) #define __NR_pread (__NR_SYSCALL_BASE+180) #define __NR_pwrite (__NR_SYSCALL_BASE+181) +#define __NR_xstat (__NR_SYSCALL_BASE+182) +#define __NR_xmknod (__NR_SYSCALL_BASE+183) #define __sys2(x) #x #define __sys1(x) __sys2(x) @@ -311,8 +313,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ */ #define __NR__exit __NR_exit static inline _syscall0(int,idle); -static inline _syscall0(int,fork); -static inline _syscall2(int,clone,unsigned long,flags,char *,esp); static inline _syscall0(int,pause); static inline _syscall1(int,setup,int,magic); static inline _syscall0(int,sync); diff --git a/include/asm-arm/xstat.h b/include/asm-arm/xstat.h new file mode 100644 index 000000000..84a9b07f9 --- /dev/null +++ b/include/asm-arm/xstat.h @@ -0,0 +1,35 @@ +/* $Id: xstat.h,v 1.1 1998/02/06 12:52:45 jj Exp $ + * xstat.h: sys_xstat/xmknod architecture dependent stuff. + * + * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + */ + +extern __inline__ int cp_xstat(struct inode *inode, struct stat64 *s, unsigned long blocks, int blksize) +{ + struct stat64 tmp; + + memset (&tmp, 0, sizeof(tmp)); + tmp.st_dev.major = MAJOR(inode->i_dev); + tmp.st_dev.minor = MINOR(inode->i_dev); + tmp.st_ino = inode->i_ino; + tmp.st_mode = inode->i_mode; + tmp.st_nlink = inode->i_nlink; + tmp.st_uid = inode->i_uid; + tmp.st_gid = inode->i_gid; + tmp.st_rdev.major = MAJOR(inode->i_rdev); + tmp.st_rdev.minor = MINOR(inode->i_rdev); + tmp.st_size = inode->i_size; + tmp.st_blksize = blksize; + tmp.st_blocks = blocks; + tmp.st_atime = inode->i_atime; + tmp.st_mtime = inode->i_mtime; + tmp.st_ctime = inode->i_ctime; + return copy_to_user(s,&tmp,sizeof(tmp)); +} + +extern __inline__ int get_user_new_dev_t(kdev_t *kdev, __new_dev_t *udev) { + __new_dev_t ndev; + if (copy_from_user (&ndev, udev, sizeof(__new_dev_t))) return -EFAULT; + *kdev = MKDEV(ndev.major, ndev.minor); + return 0; +} |