summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/Makefile78
-rw-r--r--arch/arm/kernel/arch.c322
-rw-r--r--arch/arm/kernel/arch.h15
-rw-r--r--arch/arm/kernel/armksyms.c3
-rw-r--r--arch/arm/kernel/bios32.c79
-rw-r--r--arch/arm/kernel/head-armv.S16
-rw-r--r--arch/arm/kernel/ptrace.c42
-rw-r--r--arch/arm/kernel/setup.c392
8 files changed, 565 insertions, 382 deletions
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 3920edade..c454c1350 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -8,71 +8,55 @@
HEAD_OBJ = head-$(PROCESSOR).o
ENTRY_OBJ = entry-$(PROCESSOR).o
-O_TARGET := kernel.o
-O_OBJS := $(ENTRY_OBJ) ioport.o irq.o process.o ptrace.o \
- semaphore.o setup.o signal.o sys_arm.o time.o traps.o
-
ifeq ($(CONFIG_ISA_DMA),y)
ISA_DMA_OBJS += dma-isa.o
endif
-O_OBJS_arc = dma-arc.o iic.o fiq.o time-acorn.o oldlatches.o
-O_OBJS_a5k = dma-a5k.o iic.o fiq.o time-acorn.o
-O_OBJS_rpc = dma-rpc.o iic.o fiq.o time-acorn.o
+O_OBJS_arc = dma-arc.o oldlatches.o
+O_OBJS_a5k = dma-a5k.o
+O_OBJS_rpc = dma-rpc.o
O_OBJS_ebsa110 = dma-dummy.o
-O_OBJS_footbridge = dma-footbridge.o $(ISA_DMA_OBJS) isa.o
+O_OBJS_footbridge = dma.o dma-footbridge.o $(ISA_DMA_OBJS) hw-footbridge.o isa.o
O_OBJS_nexuspci = dma-dummy.o
O_OBJS_sa1100 = dma-dummy.o fiq.o
-OX_OBJS_arc = dma.o
-OX_OBJS_a5k = dma.o
-OX_OBJS_rpc = dma.o
-OX_OBJS_ebsa110 =
-OX_OBJS_footbridge= dma.o hw-footbridge.o
-OX_OBJS_nexuspci =
-OX_OBJS_sa1100 =
+O_TARGET := kernel.o
-all: kernel.o $(HEAD_OBJ) init_task.o
+# Object file lists.
-O_OBJS += $(O_OBJS_$(MACHINE))
+obj-y := arch.o $(ENTRY_OBJ) ioport.o irq.o process.o ptrace.o \
+ semaphore.o setup.o signal.o sys_arm.o time.o traps.o \
+ $(O_OBJS_$(MACHINE))
+obj-m :=
+obj-n :=
+obj- :=
-ifeq ($(CONFIG_DEBUG_LL),y)
- O_OBJS += debug-$(PROCESSOR).o
-endif
+export-objs := armksyms.o dma.o ecard.o hw-footbridge.o leds-$(MACHINE).o
-ifeq ($(CONFIG_MODULES),y)
- OX_OBJS = armksyms.o
-endif
+obj-$(CONFIG_ARCH_ACORN) += dma.o ecard.o iic.o fiq.o time-acorn.o
+obj-$(CONFIG_DEBUG_LL) += debug-$(PROCESSOR).o
+obj-$(CONFIG_MODULES) += armksyms.o
+obj-$(CONFIG_LEDS) += leds-$(MACHINE).o
+obj-$(CONFIG_ARTHUR) += arthur.o
-ifeq ($(CONFIG_ARCH_ACORN),y)
- OX_OBJS += ecard.o
+ifeq ($(MACHINE),nexuspci)
+ obj-$(CONFIG_PCI) += plx9080.o
+else
+ obj-$(CONFIG_PCI) += bios32.o dec21285.o
endif
-ifeq ($(CONFIG_PCI),y)
- ifeq ($(MACHINE),nexuspci)
- O_OBJS += plx9080.o
- else
- O_OBJS += bios32.o dec21285.o
- endif
-endif
+# Files that are both resident and modular; remove from modular.
-ifeq ($(CONFIG_LEDS),y)
- OX_OBJS += leds-$(MACHINE).o
-endif
+obj-m := $(filter-out $(obj-y), $(obj-m))
-ifeq ($(CONFIG_MODULES),y)
- OX_OBJS += $(OX_OBJS_$(MACHINE))
-else
- O_OBJS += $(OX_OBJS_$(MACHINE))
-endif
+# Translate to Rules.make lists.
-ifeq ($(CONFIG_ARTHUR),y)
- O_OBJS += arthur.o
-else
- ifeq ($(CONFIG_ARTHUR),m)
- M_OBJS += arthur.o
- endif
-endif
+O_OBJS := $(filter-out $(export-objs), $(obj-y))
+OX_OBJS := $(filter $(export-objs), $(obj-y))
+M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
+MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
+
+all: kernel.o $(HEAD_OBJ) init_task.o
$(HEAD_OBJ): $(HEAD_OBJ:.o=.S)
$(CC) -D__ASSEMBLY__ $(AFLAGS) -DTEXTADDR=$(TEXTADDR) -traditional -c $(HEAD_OBJ:.o=.S) -o $@
diff --git a/arch/arm/kernel/arch.c b/arch/arm/kernel/arch.c
new file mode 100644
index 000000000..8645497ae
--- /dev/null
+++ b/arch/arm/kernel/arch.c
@@ -0,0 +1,322 @@
+/*
+ * linux/arch/arm/kernel/arch.c
+ *
+ * Architecture specifics
+ */
+#include <linux/config.h>
+#include <linux/tty.h>
+#include <linux/init.h>
+
+#include <asm/elf.h>
+#include <asm/setup.h>
+#include <asm/system.h>
+
+#include "arch.h"
+
+extern unsigned int system_rev;
+extern unsigned int system_serial_low;
+extern unsigned int system_serial_high;
+
+unsigned int vram_size;
+#ifdef CONFIG_ARCH_ACORN
+unsigned int memc_ctrl_reg;
+unsigned int number_mfm_drives;
+#endif
+
+/*
+ * Architecture specific fixups. This is where any
+ * parameters in the params struct are fixed up, or
+ * any additional architecture specific information
+ * is pulled from the params struct.
+ */
+static void __init
+fixup_acorn(struct machine_desc *desc, struct param_struct *params,
+ char **cmdline, struct meminfo *mi)
+{
+#ifdef CONFIG_ARCH_ACORN
+ int i;
+
+ if (machine_is_riscpc()) {
+ /*
+ * RiscPC can't handle half-word loads and stores
+ */
+ elf_hwcap &= ~HWCAP_HALF;
+
+ switch (params->u1.s.pages_in_vram) {
+ case 512:
+ vram_size += PAGE_SIZE * 256;
+ case 256:
+ vram_size += PAGE_SIZE * 256;
+ default:
+ break;
+ }
+
+ if (vram_size) {
+ desc->video_start = 0x02000000;
+ desc->video_end = 0x02000000 + vram_size;
+ }
+
+ for (i = 0; i < 4; i++) {
+ mi->bank[i].start = PHYS_OFFSET + (i << 26);
+ mi->bank[i].size =
+ params->u1.s.pages_in_bank[i] *
+ params->u1.s.page_size;
+ }
+ mi->nr_banks = 4;
+ }
+ memc_ctrl_reg = params->u1.s.memc_control_reg;
+ number_mfm_drives = (params->u1.s.adfsdrives >> 3) & 3;
+#endif
+}
+
+static void __init
+fixup_ebsa285(struct machine_desc *desc, struct param_struct *params,
+ char **cmdline, struct meminfo *mi)
+{
+ ORIG_X = params->u1.s.video_x;
+ ORIG_Y = params->u1.s.video_y;
+ ORIG_VIDEO_COLS = params->u1.s.video_num_cols;
+ ORIG_VIDEO_LINES = params->u1.s.video_num_rows;
+}
+
+/*
+ * Older NeTTroms either do not provide a parameters
+ * page, or they don't supply correct information in
+ * the parameter page.
+ */
+static void __init
+fixup_netwinder(struct machine_desc *desc, struct param_struct *params,
+ char **cmdline, struct meminfo *mi)
+{
+ if (params->u1.s.nr_pages != 0x2000 &&
+ params->u1.s.nr_pages != 0x4000) {
+ printk(KERN_WARNING "Warning: bad NeTTrom parameters "
+ "detected, using defaults\n");
+
+ params->u1.s.nr_pages = 0x2000; /* 32MB */
+ params->u1.s.ramdisk_size = 0;
+ params->u1.s.flags = FLAG_READONLY;
+ params->u1.s.initrd_start = 0;
+ params->u1.s.initrd_size = 0;
+ params->u1.s.rd_start = 0;
+ }
+}
+
+/*
+ * CATS uses soft-reboot by default, since
+ * hard reboots fail on early boards.
+ */
+static void __init
+fixup_cats(struct machine_desc *desc, struct param_struct *params,
+ char **cmdline, struct meminfo *mi)
+{
+ ORIG_VIDEO_LINES = 25;
+ ORIG_VIDEO_POINTS = 16;
+ ORIG_Y = 24;
+}
+
+static void __init
+fixup_coebsa285(struct machine_desc *desc, struct param_struct *params,
+ char **cmdline, struct meminfo *mi)
+{
+#if 0
+ extern unsigned long boot_memory_end;
+ extern char boot_command_line[];
+
+ mi->nr_banks = 1;
+ mi->bank[0].start = PHYS_OFFSET;
+ mi->bank[0].size = boot_memory_end;
+
+ *cmdline = boot_command_line;
+#endif
+}
+
+static void __init
+fixup_sa1100(struct machine_desc *desc, struct param_struct *params,
+ char **cmdline, struct meminfo *mi)
+{
+#ifdef CONFIG_ARCH_SA1100
+ int i;
+ extern struct mem_desc {
+ unsigned long phys_start;
+ unsigned long length;
+ } mem_desc[];
+ extern unsigned int mem_desc_size;
+
+ for( i = 0; i < mem_desc_size; i++ ) {
+ if( i >= NR_BANKS ) {
+ printk( __FUNCTION__
+ ": mem_desc too large for meminfo structure\n");
+ break;
+ }
+ mi->bank[i].start = mem_desc[i].phys_start;
+ mi->bank[i].size = mem_desc[i].length;
+ }
+ mi->nr_banks = i;
+
+#if defined(CONFIG_SA1100_BRUTUS)
+ ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
+ setup_ramdisk( 1, 0, 0, 8192 );
+ setup_initrd( __phys_to_virt(0xd8000000), 0x00400000 );
+#elif defined(CONFIG_SA1100_EMPEG)
+ ROOT_DEV = MKDEV( 3, 1 ); /* /dev/hda1 */
+ setup_ramdisk( 1, 0, 0, 4096 );
+ setup_initrd( 0xd0000000+((1024-320)*1024), (320*1024) );
+#elif defined(CONFIG_SA1100_TIFON)
+ ROOT_DEV = MKDEV(UNNAMED_MAJOR, 0);
+ setup_ramdisk(1, 0, 0, 4096);
+ setup_initrd( 0xd0000000 + 0x1100004, 0x140000 );
+#elif defined(CONFIG_SA1100_VICTOR)
+ ROOT_DEV = MKDEV( 60, 2 );
+
+ /* Get command line parameters passed from the loader (if any) */
+ if( *((char*)0xc0000000) )
+ strcpy( default_command_line, ((char *)0xc0000000) );
+
+ /* power off if any problem */
+ strcat( default_command_line, " panic=1" );
+#elif defined(CONFIG_SA1100_LART)
+ ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
+ setup_ramdisk(1, 0, 0, 8192);
+ setup_initrd(0xc0400000, 0x00400000);
+#endif
+#endif
+}
+
+#define NO_PARAMS 0
+#define NO_VIDEO 0, 0
+
+/*
+ * This is the list of all architectures supported by
+ * this kernel. This should be integrated with the list
+ * in head-armv.S.
+ */
+static struct machine_desc machine_desc[] __attribute__ ((__section__ (".arch.info"))) = {
+ {
+ MACH_TYPE_EBSA110,
+ "EBSA110", /* RMK */
+ 0x00000400,
+ NO_VIDEO,
+ 1, 0, 1, 1, 1,
+ NULL
+ }, {
+ MACH_TYPE_RISCPC,
+ "Acorn-RiscPC", /* RMK */
+ 0x10000100,
+ NO_VIDEO,
+ 1, 1, 0, 0, 0,
+ fixup_acorn
+ }, {
+ 2,
+ "unknown",
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_NEXUSPCI,
+ "FTV/PCI", /* Philip Blundell */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_EBSA285,
+ "EBSA285", /* RMK */
+ 0x00000100,
+ 0x000a0000, 0x000bffff,
+ 0, 0, 0, 0, 0,
+ fixup_ebsa285
+ }, {
+ MACH_TYPE_NETWINDER,
+ "Rebel-NetWinder", /* RMK */
+ 0x00000100,
+ 0x000a0000, 0x000bffff,
+ 1, 0, 1, 0, 0,
+ fixup_netwinder
+ }, {
+ MACH_TYPE_CATS,
+ "Chalice-CATS", /* Philip Blundell */
+ NO_PARAMS,
+ 0x000a0000, 0x000bffff,
+ 0, 0, 0, 0, 1,
+ fixup_cats
+ }, {
+ MACH_TYPE_TBOX,
+ "unknown-TBOX", /* Philip Blundell */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_CO285,
+ "co-EBSA285", /* Mark van Doesburg */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ fixup_coebsa285
+ }, {
+ MACH_TYPE_CLPS7110,
+ "CL-PS7110", /* Werner Almesberger */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_ARCHIMEDES,
+ "Acorn-Archimedes",/* RMK/DAG */
+ 0x0207c000,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ fixup_acorn
+ }, {
+ MACH_TYPE_A5K,
+ "Acorn-A5000", /* RMK/PB */
+ 0x0207c000,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ fixup_acorn
+ }, {
+ MACH_TYPE_ETOILE,
+ "Etoile", /* Alex de Vries */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_LACIE_NAS,
+ "LaCie_NAS", /* Benjamin Herrenschmidt */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_CLPS7500,
+ "CL-PS7500", /* Philip Blundell */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_SHARK,
+ "Shark", /* Alexander Schulz */
+ NO_PARAMS,
+ 0x06000000, 0x06000000+0x001fffff,
+ 0, 0, 0, 0, 0,
+ NULL
+ }, {
+ MACH_TYPE_SA1100,
+ "SA1100-based", /* Nicolas Pitre */
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ fixup_sa1100
+ }, {
+ MACH_TYPE_PERSONAL_SERVER,
+ "Compaq Personal Server",
+ NO_PARAMS,
+ NO_VIDEO,
+ 0, 0, 0, 0, 0,
+ NULL
+ }
+};
diff --git a/arch/arm/kernel/arch.h b/arch/arm/kernel/arch.h
new file mode 100644
index 000000000..b7635b11e
--- /dev/null
+++ b/arch/arm/kernel/arch.h
@@ -0,0 +1,15 @@
+struct machine_desc {
+ unsigned int nr; /* architecture number */
+ const char *name; /* architecture name */
+ unsigned int param_offset; /* parameter page */
+ unsigned int video_start; /* start of video RAM */
+ unsigned int video_end; /* end of video RAM */
+ unsigned int reserve_lp0 :1; /* never has lp0 */
+ unsigned int reserve_lp1 :1; /* never has lp1 */
+ unsigned int reserve_lp2 :1; /* never has lp2 */
+ unsigned int broken_hlt :1; /* hlt is broken */
+ unsigned int soft_reboot :1; /* soft reboot */
+ void (*fixup)(struct machine_desc *,
+ struct param_struct *, char **,
+ struct meminfo *);
+};
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index c445daeee..5a1b4ed31 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -8,6 +8,7 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/in6.h>
+#include <linux/vt_kern.h>
#include <asm/byteorder.h>
#include <asm/elf.h>
@@ -83,6 +84,8 @@ EXPORT_SYMBOL(fpundefinstr);
EXPORT_SYMBOL(ret_from_exception);
#endif
+EXPORT_SYMBOL(kd_mksound);
+
/* platform dependent support */
EXPORT_SYMBOL(dump_thread);
EXPORT_SYMBOL(dump_fpu);
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 7a1b57c22..1b0a064d0 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -222,8 +222,9 @@ static u8 __init no_swizzle(struct pci_dev *dev, u8 *pin)
return 0;
}
-#ifdef CONFIG_FOOTBRIDGE
/* ebsa285 host-specific stuff */
+
+#ifdef CONFIG_ARCH_EBSA285
static int irqmap_ebsa285[] __initdata = { IRQ_IN1, IRQ_IN0, IRQ_PCI, IRQ_IN3 };
static u8 __init ebsa285_swizzle(struct pci_dev *dev, u8 *pin)
@@ -251,7 +252,9 @@ static struct hw_pci ebsa285_pci __initdata = {
ebsa285_swizzle,
ebsa285_map_irq
};
+#endif
+#ifdef CONFIG_CATS
/* cats host-specific stuff */
static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
@@ -277,7 +280,9 @@ static struct hw_pci cats_pci __initdata = {
no_swizzle,
cats_map_irq
};
+#endif
+#ifdef CONFIG_ARCH_NETWINDER
/* netwinder host-specific stuff */
static int __init netwinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
{
@@ -318,6 +323,41 @@ static struct hw_pci netwinder_pci __initdata = {
};
#endif
+#ifdef CONFIG_PERSONAL_SERVER
+static int irqmap_personal_server[] __initdata = {
+ IRQ_IN0, IRQ_IN1, IRQ_IN2, IRQ_IN3, 0, 0, 0,
+ IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI
+};
+
+static int __init personal_server_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+ unsigned char line;
+
+ pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
+
+ if (line > 0x40 && line <= 0x5f) {
+ /* line corresponds to the bit controlling this interrupt
+ * in the footbridge. Ignore the first 8 interrupt bits,
+ * look up the rest in the map. IN0 is bit number 8
+ */
+ return irqmap_personal_server[(line & 0x1f) - 8];
+ } else if (line == 0) {
+ /* no interrupt */
+ return 0;
+ } else
+ return irqmap_personal_server[(line - 1) & 3];
+}
+
+static struct hw_pci personal_server_pci __initdata = {
+ dc21285_init,
+ 0x9000,
+ 0x00100000,
+ no_swizzle,
+ personal_server_map_irq
+};
+
+#endif
+
#ifdef CONFIG_ARCH_NEXUSPCI
/*
* Owing to a PCB cockup, issue A backplanes are wired thus:
@@ -352,17 +392,38 @@ void __init pcibios_init(void)
{
struct hw_pci *hw_pci = NULL;
-#ifdef CONFIG_FOOTBRIDGE
- if (machine_is_ebsa285())
- hw_pci = &ebsa285_pci;
- else if (machine_is_cats())
- hw_pci = &cats_pci;
- else if (machine_is_netwinder())
- hw_pci = &netwinder_pci;
+ do {
+#ifdef CONFIG_ARCH_EBSA285
+ if (machine_is_ebsa285()) {
+ hw_pci = &ebsa285_pci;
+ break;
+ }
+#endif
+#ifdef CONFIG_CATS
+ if (machine_is_cats()) {
+ hw_pci = &cats_pci;
+ break;
+ }
+#endif
+#ifdef CONFIG_ARCH_NETWINDER
+ if (machine_is_netwinder()) {
+ hw_pci = &netwinder_pci;
+ break;
+ }
+#endif
+#ifdef CONFIG_PERSONAL_SERVER
+ if (machine_is_personal_server()) {
+ hw_pci = &personal_server_pci;
+ break;
+ }
#endif
#ifdef CONFIG_ARCH_NEXUSPCI
- hw_pci = &ftv_pci;
+ if (machine_is_nexuspci()) {
+ hw_pci = &ftv_pci;
+ break;
+ }
#endif
+ } while (0);
if (hw_pci == NULL)
return;
diff --git a/arch/arm/kernel/head-armv.S b/arch/arm/kernel/head-armv.S
index 35e71a4a9..27a280b8b 100644
--- a/arch/arm/kernel/head-armv.S
+++ b/arch/arm/kernel/head-armv.S
@@ -22,6 +22,7 @@
.equ SYMBOL_NAME(swapper_pg_dir), TEXTADDR - 0x8000 + SWAPPER_PGDIR_OFFSET
.section ".text.init",#alloc,#execinstr
+ .type stext, #function
ENTRY(stext)
ENTRY(_stext)
@@ -311,6 +312,7 @@ __lookup_architecture_type:
* required for debugging information to be shown to the user.
* paging_init() does the real page table initialisation.
*/
+ .type __arch_types_start, #object
@ 0x00 - DEC EBSA110
__arch_types_start:
.long 0
@@ -398,15 +400,15 @@ __arch_types_start:
@ 0x0e - CL-PS7500
.long 0
- .long 0
- .long 0
- .long 0
+ .long 0x10000000
+ .long 0x03000000
+ .long 0xe0000000
- @ 0x0f - Shark
- .long 0
- .long 0
- .long 0
+ @ 0x0f - Digital Shark (DNARD)
.long 0
+ .long 0x08000000
+ .long 0x40000000
+ .long 0xe0000000
@ 0x10 - SA1100
.long 0
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 0692d1a6c..0ace4c898 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -521,6 +521,48 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
/* give it a chance to run. */
ret = 0;
goto out;
+
+ case PTRACE_GETREGS:
+ { /* Get all gp regs from the child. */
+ unsigned char *stack;
+
+ ret = 0;
+ stack = (unsigned char *)((unsigned long)child + 8192 - sizeof(struct pt_regs));
+ if (copy_to_user((void *)data, stack,
+ sizeof(struct pt_regs)))
+ ret = -EFAULT;
+
+ goto out;
+ };
+
+ case PTRACE_SETREGS:
+ {
+ /* Set all gp regs in the child. */
+ unsigned char *stack;
+
+ ret = 0;
+ stack = (unsigned char *)((unsigned long)child + 8192 - sizeof(struct pt_regs));
+ if (copy_from_user(stack, (void *)data,
+ sizeof(struct pt_regs)))
+ ret = -EFAULT;
+ goto out;
+ };
+
+ case PTRACE_GETFPREGS:
+ /* Get the child FPU state. */
+ ret = 0;
+ if (copy_to_user((void *)data, &child->thread.fpstate,
+ sizeof(struct user_fp)))
+ ret = -EFAULT;
+ goto out;
+
+ case PTRACE_SETFPREGS:
+ /* Set the child FPU state. */
+ ret = 0;
+ if (copy_from_user(&child->thread.fpstate, (void *)data,
+ sizeof(struct user_fp)))
+ ret = -EFAULT;
+ goto out;
case PTRACE_DETACH: /* detach a process that was attached. */
ret = -EIO;
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 5815529aa..6a3429bdd 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1,13 +1,12 @@
/*
* linux/arch/arm/kernel/setup.c
*
- * Copyright (C) 1995-1999 Russell King
+ * Copyright (C) 1995-2000 Russell King
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
-#include <linux/tty.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/utsname.h>
@@ -23,6 +22,8 @@
#include <asm/setup.h>
#include <asm/system.h>
+#include "arch.h"
+
#ifndef MEM_SIZE
#define MEM_SIZE (16*1024*1024)
#endif
@@ -31,6 +32,7 @@
#define CONFIG_CMDLINE ""
#endif
+extern void paging_init(struct meminfo *);
extern void reboot_setup(char *str);
extern void disable_hlt(void);
extern int root_mountflags;
@@ -38,33 +40,11 @@ extern int _stext, _text, _etext, _edata, _end;
unsigned int processor_id;
unsigned int __machine_arch_type;
-unsigned int vram_size;
unsigned int system_rev;
unsigned int system_serial_low;
unsigned int system_serial_high;
unsigned int elf_hwcap;
-#ifdef CONFIG_ARCH_ACORN
-unsigned int memc_ctrl_reg;
-unsigned int number_mfm_drives;
-#endif
-
-struct meminfo meminfo;
-
-struct machine_desc {
- const char *name; /* architecture name */
- unsigned int param_offset; /* parameter page */
- unsigned int video_start; /* start of video RAM */
- unsigned int video_end; /* end of video RAM */
- unsigned int reserve_lp0 :1; /* never has lp0 */
- unsigned int reserve_lp1 :1; /* never has lp1 */
- unsigned int reserve_lp2 :1; /* never has lp2 */
- unsigned int broken_hlt :1; /* hlt is broken */
- unsigned int soft_reboot :1; /* soft reboot */
- void (*fixup)(struct machine_desc *,
- struct param_struct *, char **);
-};
-
#ifdef MULTI_CPU
struct processor processor;
#endif
@@ -156,6 +136,33 @@ static void __init setup_processor(void)
cpu_proc_init();
}
+static struct machine_desc * __init setup_architecture(unsigned int nr)
+{
+ extern struct machine_desc __arch_info_begin, __arch_info_end;
+ struct machine_desc *list;
+
+ /*
+ * locate architecture in the list of supported architectures.
+ */
+ for (list = &__arch_info_begin; list < &__arch_info_end; list++)
+ if (list->nr == nr)
+ break;
+
+ /*
+ * If the architecture type is not recognised, then we
+ * can co nothing...
+ */
+ if (list >= &__arch_info_end) {
+ printk("Architecture configuration botched (nr %d), unable "
+ "to continue.\n", nr);
+ while (1);
+ }
+
+ printk("Architecture: %s\n", list->name);
+
+ return list;
+}
+
static unsigned long __init memparse(char *ptr, char **retptr)
{
unsigned long ret = simple_strtoul(ptr, retptr, 0);
@@ -180,7 +187,7 @@ static unsigned long __init memparse(char *ptr, char **retptr)
* are "size[KkMm]"
*/
static void __init
-parse_cmdline(char **cmdline_p, char *from)
+parse_cmdline(struct meminfo *mi, char **cmdline_p, char *from)
{
char c = ' ', *to = command_line;
int usermem = 0, len = 0;
@@ -198,7 +205,7 @@ parse_cmdline(char **cmdline_p, char *from)
*/
if (usermem == 0) {
usermem = 1;
- meminfo.nr_banks = 0;
+ mi->nr_banks = 0;
}
start = PHYS_OFFSET;
@@ -206,9 +213,9 @@ parse_cmdline(char **cmdline_p, char *from)
if (*from == '@')
start = memparse(from + 1, &from);
- meminfo.bank[meminfo.nr_banks].start = start;
- meminfo.bank[meminfo.nr_banks].size = size;
- meminfo.nr_banks += 1;
+ mi->bank[mi->nr_banks].start = start;
+ mi->bank[mi->nr_banks].size = size;
+ mi->nr_banks += 1;
}
c = *from++;
if (!c)
@@ -265,7 +272,8 @@ static void __init setup_initrd(unsigned int start, unsigned int size)
#define free_bootmem(s,sz) free_bootmem((s)<<PAGE_SHIFT, (sz)<<PAGE_SHIFT)
#define reserve_bootmem(s,sz) reserve_bootmem((s)<<PAGE_SHIFT, (sz)<<PAGE_SHIFT)
-static unsigned int __init find_bootmap_pfn(unsigned int bootmap_pages)
+static unsigned int __init
+find_bootmap_pfn(struct meminfo *mi, unsigned int bootmap_pages)
{
unsigned int start_pfn, bank, bootmap_pfn;
@@ -278,25 +286,25 @@ static unsigned int __init find_bootmap_pfn(unsigned int bootmap_pages)
*/
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start) {
- if (__pa(initrd_end) > meminfo.end) {
+ if (__pa(initrd_end) > mi->end) {
printk ("initrd extends beyond end of memory "
"(0x%08lx > 0x%08lx) - disabling initrd\n",
- __pa(initrd_end), meminfo.end);
+ __pa(initrd_end), mi->end);
initrd_start = 0;
initrd_end = 0;
}
}
#endif
- for (bank = 0; bank < meminfo.nr_banks; bank ++) {
+ for (bank = 0; bank < mi->nr_banks; bank ++) {
unsigned int start, end;
- if (meminfo.bank[bank].size == 0)
+ if (mi->bank[bank].size == 0)
continue;
- start = O_PFN_UP(meminfo.bank[bank].start);
- end = O_PFN_DOWN(meminfo.bank[bank].size +
- meminfo.bank[bank].start);
+ start = O_PFN_UP(mi->bank[bank].start);
+ end = O_PFN_DOWN(mi->bank[bank].size +
+ mi->bank[bank].start);
if (end < start_pfn)
continue;
@@ -322,7 +330,7 @@ static unsigned int __init find_bootmap_pfn(unsigned int bootmap_pages)
/*
* Initialise the bootmem allocator.
*/
-static void __init setup_bootmem(void)
+static void __init setup_bootmem(struct meminfo *mi)
{
unsigned int end_pfn, start_pfn, bootmap_pages, bootmap_pfn;
unsigned int i;
@@ -330,21 +338,21 @@ static void __init setup_bootmem(void)
/*
* Calculate the physical address of the top of memory.
*/
- meminfo.end = 0;
- for (i = 0; i < meminfo.nr_banks; i++) {
+ mi->end = 0;
+ for (i = 0; i < mi->nr_banks; i++) {
unsigned long end;
- if (meminfo.bank[i].size != 0) {
- end = meminfo.bank[i].start + meminfo.bank[i].size;
- if (meminfo.end < end)
- meminfo.end = end;
+ if (mi->bank[i].size != 0) {
+ end = mi->bank[i].start + mi->bank[i].size;
+ if (mi->end < end)
+ mi->end = end;
}
}
start_pfn = O_PFN_UP(PHYS_OFFSET);
- end_pfn = O_PFN_DOWN(meminfo.end);
+ end_pfn = O_PFN_DOWN(mi->end);
bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
- bootmap_pfn = find_bootmap_pfn(bootmap_pages);
+ bootmap_pfn = find_bootmap_pfn(mi, bootmap_pages);
/*
* Initialise the boot-time allocator
@@ -354,10 +362,10 @@ static void __init setup_bootmem(void)
/*
* Register all available RAM with the bootmem allocator.
*/
- for (i = 0; i < meminfo.nr_banks; i++)
- if (meminfo.bank[i].size)
- free_bootmem(O_PFN_UP(meminfo.bank[i].start),
- PFN_SIZE(meminfo.bank[i].size));
+ for (i = 0; i < mi->nr_banks; i++)
+ if (mi->bank[i].size)
+ free_bootmem(O_PFN_UP(mi->bank[i].start),
+ PFN_SIZE(mi->bank[i].size));
/*
* Register the reserved regions with bootmem
@@ -379,7 +387,8 @@ static void __init setup_bootmem(void)
#endif
}
-static void __init request_standard_resources(struct machine_desc *mdesc)
+static void __init
+request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc)
{
struct resource *res;
int i;
@@ -389,14 +398,14 @@ static void __init request_standard_resources(struct machine_desc *mdesc)
kernel_data.start = __virt_to_bus(init_mm.end_code);
kernel_data.end = __virt_to_bus(init_mm.brk - 1);
- for (i = 0; i < meminfo.nr_banks; i++) {
+ for (i = 0; i < mi->nr_banks; i++) {
unsigned long virt_start, virt_end;
- if (meminfo.bank[i].size == 0)
+ if (mi->bank[i].size == 0)
continue;
- virt_start = __phys_to_virt(meminfo.bank[i].start);
- virt_end = virt_start + meminfo.bank[i].size - 1;
+ virt_start = __phys_to_virt(mi->bank[i].start);
+ virt_end = virt_start + mi->bank[i].size - 1;
res = alloc_bootmem_low(sizeof(*res));
res->name = "System RAM";
@@ -432,270 +441,15 @@ static void __init request_standard_resources(struct machine_desc *mdesc)
request_resource(&ioport_resource, &lp2);
}
-/*
- * Architecture specific fixups. This is where any
- * parameters in the params struct are fixed up, or
- * any additional architecture specific information
- * is pulled from the params struct.
- */
-static void __init
-fixup_acorn(struct machine_desc *desc, struct param_struct *params,
- char **cmdline)
-{
-#ifdef CONFIG_ARCH_ACORN
- int i;
-
- if (machine_is_riscpc()) {
- /*
- * RiscPC can't handle half-word loads and stores
- */
- elf_hwcap &= ~HWCAP_HALF;
-
- switch (params->u1.s.pages_in_vram) {
- case 512:
- vram_size += PAGE_SIZE * 256;
- case 256:
- vram_size += PAGE_SIZE * 256;
- default:
- break;
- }
-
- if (vram_size) {
- desc->video_start = 0x02000000;
- desc->video_end = 0x02000000 + vram_size;
- }
-
- for (i = 0; i < 4; i++) {
- meminfo.bank[i].start = PHYS_OFFSET + (i << 26);
- meminfo.bank[i].size =
- params->u1.s.pages_in_bank[i] *
- params->u1.s.page_size;
- }
- meminfo.nr_banks = 4;
- }
- memc_ctrl_reg = params->u1.s.memc_control_reg;
- number_mfm_drives = (params->u1.s.adfsdrives >> 3) & 3;
-#endif
-}
-
-static void __init
-fixup_ebsa285(struct machine_desc *desc, struct param_struct *params,
- char **cmdline)
-{
- ORIG_X = params->u1.s.video_x;
- ORIG_Y = params->u1.s.video_y;
- ORIG_VIDEO_COLS = params->u1.s.video_num_cols;
- ORIG_VIDEO_LINES = params->u1.s.video_num_rows;
-}
-
-/*
- * Older NeTTroms either do not provide a parameters
- * page, or they don't supply correct information in
- * the parameter page.
- */
-static void __init
-fixup_netwinder(struct machine_desc *desc, struct param_struct *params,
- char **cmdline)
-{
- if (params->u1.s.nr_pages != 0x2000 &&
- params->u1.s.nr_pages != 0x4000) {
- printk(KERN_WARNING "Warning: bad NeTTrom parameters "
- "detected, using defaults\n");
-
- params->u1.s.nr_pages = 0x2000; /* 32MB */
- params->u1.s.ramdisk_size = 0;
- params->u1.s.flags = FLAG_READONLY;
- params->u1.s.initrd_start = 0;
- params->u1.s.initrd_size = 0;
- params->u1.s.rd_start = 0;
- }
-}
-
-/*
- * CATS uses soft-reboot by default, since
- * hard reboots fail on early boards.
- */
-static void __init
-fixup_cats(struct machine_desc *desc, struct param_struct *params,
- char **cmdline)
-{
- ORIG_VIDEO_LINES = 25;
- ORIG_VIDEO_POINTS = 16;
- ORIG_Y = 24;
-}
-
-static void __init
-fixup_coebsa285(struct machine_desc *desc, struct param_struct *params,
- char **cmdline)
-{
-#if 0
- extern unsigned long boot_memory_end;
- extern char boot_command_line[];
-
- meminfo.nr_banks = 1;
- meminfo.bank[0].start = PHYS_OFFSET;
- meminfo.bank[0].size = boot_memory_end;
-
- *cmdline = boot_command_line;
-#endif
-}
-
-static void __init
-fixup_sa1100(struct machine_desc *desc, struct param_struct *params,
- char **cmdline)
-{
-#ifdef CONFIG_ARCH_SA1100
- int i;
- extern struct mem_desc {
- unsigned long phys_start;
- unsigned long length;
- } mem_desc[];
- extern unsigned int mem_desc_size;
-
- for( i = 0; i < mem_desc_size; i++ ) {
- if( i >= NR_BANKS ) {
- printk( __FUNCTION__
- ": mem_desc too large for meminfo structure\n");
- break;
- }
- meminfo.bank[i].start = mem_desc[i].phys_start;
- meminfo.bank[i].size = mem_desc[i].length;
- }
- meminfo.nr_banks = i;
-
-#if defined(CONFIG_SA1100_BRUTUS)
- ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
- setup_ramdisk( 1, 0, 0, 8192 );
- setup_initrd( __phys_to_virt(0xd8000000), 0x00400000 );
-#elif defined(CONFIG_SA1100_EMPEG)
- ROOT_DEV = MKDEV( 3, 1 ); /* /dev/hda1 */
- setup_ramdisk( 1, 0, 0, 4096 );
- setup_initrd( 0xd0000000+((1024-320)*1024), (320*1024) );
-#elif defined(CONFIG_SA1100_TIFON)
- ROOT_DEV = MKDEV(UNNAMED_MAJOR, 0);
- setup_ramdisk(1, 0, 0, 4096);
- setup_initrd( 0xd0000000 + 0x1100004, 0x140000 );
-#elif defined(CONFIG_SA1100_VICTOR)
- ROOT_DEV = MKDEV( 60, 2 );
-
- /* Get command line parameters passed from the loader (if any) */
- if( *((char*)0xc0000000) )
- strcpy( default_command_line, ((char *)0xc0000000) );
-
- /* power off if any problem */
- strcat( default_command_line, " panic=1" );
-#elif defined(CONFIG_SA1100_LART)
- ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
- setup_ramdisk(1, 0, 0, 8192);
- setup_initrd(0xc0400000, 0x00400000);
-#endif
-#endif
-}
-
-#define NO_PARAMS 0
-#define NO_VIDEO 0, 0
-
-/*
- * This is the list of all architectures supported by
- * this kernel. This should be integrated with the list
- * in head-armv.S.
- */
-static struct machine_desc machine_desc[] __initdata = {
- { "EBSA110", /* RMK */
- 0x00000400,
- NO_VIDEO,
- 1, 0, 1, 1, 1,
- NULL
- }, { "Acorn-RiscPC", /* RMK */
- 0x10000100,
- NO_VIDEO,
- 1, 1, 0, 0, 0,
- fixup_acorn
- }, { "unknown",
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- NULL
- }, { "FTV/PCI", /* Philip Blundell */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- NULL
- }, { "EBSA285", /* RMK */
- 0x00000100,
- 0x000a0000, 0x000bffff,
- 0, 0, 0, 0, 0,
- fixup_ebsa285
- }, { "Rebel-NetWinder", /* RMK */
- 0x00000100,
- 0x000a0000, 0x000bffff,
- 1, 0, 1, 0, 0,
- fixup_netwinder
- }, { "Chalice-CATS", /* Philip Blundell */
- NO_PARAMS,
- 0x000a0000, 0x000bffff,
- 0, 0, 0, 0, 1,
- fixup_cats
- }, { "unknown-TBOX", /* Philip Blundell */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- NULL
- }, { "co-EBSA285", /* Mark van Doesburg */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- fixup_coebsa285
- }, { "CL-PS7110", /* Werner Almesberger */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- NULL
- }, { "Acorn-Archimedes",/* RMK/DAG */
- 0x0207c000,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- fixup_acorn
- }, { "Acorn-A5000", /* RMK/PB */
- 0x0207c000,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- fixup_acorn
- }, { "Etoile", /* Alex de Vries */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- NULL
- }, { "LaCie_NAS", /* Benjamin Herrenschmidt */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- NULL
- }, { "CL-PS7500", /* Philip Blundell */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- NULL
- }, { "Shark", /* Alexander Schulz */
- NO_PARAMS,
- /* do you really mean 0x200000? */
- 0x06000000, 0x06000000+0x00200000,
- 0, 0, 0, 0, 0,
- NULL
- }, { "SA1100-based", /* Nicolas Pitre */
- NO_PARAMS,
- NO_VIDEO,
- 0, 0, 0, 0, 0,
- fixup_sa1100
- }
-};
-
void __init setup_arch(char **cmdline_p)
{
struct param_struct *params = NULL;
struct machine_desc *mdesc;
+ struct meminfo meminfo;
char *from = default_command_line;
+ memset(&meminfo, 0, sizeof(meminfo));
+
#if defined(CONFIG_ARCH_ARC)
__machine_arch_type = MACH_TYPE_ARCHIMEDES;
#elif defined(CONFIG_ARCH_A5K)
@@ -706,7 +460,7 @@ void __init setup_arch(char **cmdline_p)
ROOT_DEV = MKDEV(0, 255);
- mdesc = machine_desc + machine_arch_type;
+ mdesc = setup_architecture(machine_arch_type);
machine_name = mdesc->name;
if (mdesc->broken_hlt)
@@ -719,7 +473,7 @@ void __init setup_arch(char **cmdline_p)
params = phys_to_virt(mdesc->param_offset);
if (mdesc->fixup)
- mdesc->fixup(mdesc, params, &from);
+ mdesc->fixup(mdesc, params, &from, &meminfo);
if (params && params->u1.s.page_size != PAGE_SIZE) {
printk(KERN_WARNING "Warning: bad configuration page, "
@@ -763,11 +517,11 @@ void __init setup_arch(char **cmdline_p)
memcpy(saved_command_line, from, COMMAND_LINE_SIZE);
saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
- parse_cmdline(cmdline_p, from);
- setup_bootmem();
- request_standard_resources(mdesc);
+ parse_cmdline(&meminfo, cmdline_p, from);
+ setup_bootmem(&meminfo);
+ request_standard_resources(&meminfo, mdesc);
- paging_init();
+ paging_init(&meminfo);
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)