Commit f6d64aee authored by Ralf Bächle's avatar Ralf Bächle Committed by Linus Torvalds

[PATCH] MIPS merge, generic mips bits.

This contains all the generic 32-bit MIPS code, so all arch/mips/ and
include/asm-mips/ stuff.
parent 2e7f53ec
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
The code for the Algorithmics P4032 evaluation board is currently under
development. I'll release it when it's up to the same strength as
the other ports.
Ralf
......@@ -3,11 +3,9 @@
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1995, 1998, 2001 by Ralf Baechle
# Copyright (C) 1995, 1998, 2001, 2002 by Ralf Baechle
#
OBJS = milo.o a.out.o
#
# Some DECstations need all possible sections of an ECOFF executable
#
......@@ -21,25 +19,33 @@ endif
# Drop some uninteresting sections in the kernel.
# This is only relevant for ELF kernels but doesn't hurt a.out
#
drop-sections = .reginfo .mdebug
drop-sections = .reginfo .mdebug .comment .note
strip-flags = $(addprefix --remove-section=,$(drop-sections))
all: vmlinux.ecoff addinitrd
vmlinux.ecoff: elf2ecoff $(TOPDIR)/vmlinux
./elf2ecoff $(TOPDIR)/vmlinux vmlinux.ecoff $(E2EFLAGS)
vmlinux.rm200: vmlinux
$(OBJCOPY) \
--change-addresses=0xfffffffc \
-O elf32-tradlittlemips \
$(strip-flags) \
$< $@
vmlinux.ecoff: $(obj)/elf2ecoff vmlinux
./elf2ecoff vmlinux $(obj)/vmlinux.ecoff $(E2EFLAGS)
elf2ecoff: elf2ecoff.c
$(obj)/elf2ecoff: $(obj)/elf2ecoff.c
$(HOSTCC) -o $@ $^
addinitrd: addinitrd.c
$(obj)/addinitrd: $(obj)/addinitrd.c
$(HOSTCC) -o $@ $^
clean:
rm -f vmlinux.ecoff
rm -f zImage zImage.tmp
archhelp:
@echo '* vmlinux.rm200 - Bootable kernel image for RM200C'
mrproper:
rm -f vmlinux.ecoff
rm -f addinitrd
rm -f elf2ecoff
CLEAN_FILES += addinitrd \
elf2ecoff \
vmlinux.ecoff \
vmlinux.rm200 \
zImage.tmp \
zImage
......@@ -8,6 +8,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <netinet/in.h>
#include "ecoff.h"
......@@ -44,7 +46,7 @@ int main (int argc, char *argv[])
char buf[1024];
unsigned long loadaddr;
unsigned long initrd_header[2];
int i;
int i,cnt;
int swab = 0;
if (argc != 4) {
......@@ -60,7 +62,6 @@ int main (int argc, char *argv[])
die ("read aout header");
if (read (fd_vmlinux, esecs, sizeof esecs) != sizeof esecs)
die ("read section headers");
/*
* check whether the file is good for us
*/
......@@ -98,9 +99,20 @@ int main (int argc, char *argv[])
die ("write aout header");
if (write (fd_outfile, esecs, sizeof esecs) != sizeof esecs)
die ("write section headers");
while ((i = read (fd_vmlinux, buf, sizeof buf)) > 0)
/* skip padding */
if(lseek(fd_vmlinux, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
die ("lseek vmlinux");
if(lseek(fd_outfile, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
die ("lseek outfile");
/* copy text segment */
cnt = SWAB(eaout.tsize);
while (cnt) {
if ((i = read (fd_vmlinux, buf, sizeof buf)) <= 0)
die ("read vmlinux");
if (write (fd_outfile, buf, i) != i)
die ("write vmlinux");
cnt -= i;
}
if (write (fd_outfile, initrd_header, sizeof initrd_header) != sizeof initrd_header)
die ("write initrd header");
while ((i = read (fd_initrd, buf, sizeof buf)) > 0)
......
This diff is collapsed.
......@@ -2,45 +2,45 @@
# Makefile for the Linux/MIPS kernel.
#
# EXTRA_AFLAGS = -mips3 -mcpu=r4000 # not used?
extra-y := head.o init_task.o
obj-y += branch.o process.o signal.o entry.o \
traps.o ptrace.o vm86.o ioport.o reset.o \
semaphore.o setup.o syscall.o sysmips.o \
ipc.o scall_o32.o unaligned.o
obj-y += branch.o cpu-probe.o process.o signal.o entry.o traps.o \
ptrace.o irq.o reset.o semaphore.o setup.o syscall.o \
sysmips.o ipc.o scall_o32.o time.o unaligned.o
obj-$(CONFIG_MODULES) += mips_ksyms.o
ifdef CONFIG_CPU_R3000
obj-y += r2300_misc.o r2300_fpu.o r2300_switch.o
else
obj-y += r4k_misc.o r4k_switch.o
ifdef CONFIG_CPU_R6000
obj-y += r6000_fpu.o
else
obj-y += r4k_fpu.o
endif
endif
obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o
obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o
obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R4000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R4300) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R4X00) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R5000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R5432) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_RM7000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_NEVADA) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R10000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_SB1) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R6000) += r6000_fpu.o r4k_switch.o
obj-$(CONFIG_SMP) += smp.o
# Old style irq support, going to die in 2.5.
obj-$(CONFIG_NEW_IRQ) += irq.o
obj-$(CONFIG_ROTTEN_IRQ) += old-irq.o
obj-$(CONFIG_I8259) += i8259.o
# transition from old time.c to new time.c
# some boards uses old-time.c, some use time.c, and some use their own ones
obj-$(CONFIG_OLD_TIME_C) += old-time.o
obj-$(CONFIG_NEW_TIME_C) += time.o
obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
obj-$(CONFIG_BINFMT_IRIX) += irixelf.o irixioctl.o irixsig.o sysirix.o \
irixinv.o
obj-$(CONFIG_REMOTE_DEBUG) += gdb-low.o gdb-stub.o
obj-$(CONFIG_PCI) += pci-dma.o
obj-$(CONFIG_KGDB) += gdb-low.o gdb-stub.o
obj-$(CONFIG_PROC_FS) += proc.o
ifdef CONFIG_PCI
obj-$(CONFIG_NEW_PCI) += pci.o
obj-$(CONFIG_PCI_AUTO) += pci_auto.o
ifndef CONFIG_MAPPED_PCI_IO
obj-y += pci-dma.o
endif
obj-$(CONFIG_MODULES) += module.o
EXTRA_AFLAGS := $(CFLAGS)
......@@ -16,7 +16,6 @@
#include <asm/inst.h>
#include <asm/ptrace.h>
#include <asm/uaccess.h>
#include <asm/bootinfo.h>
#include <asm/processor.h>
/*
......@@ -164,10 +163,10 @@ int __compute_return_epc(struct pt_regs *regs)
* And now the FPA/cp1 branch instructions.
*/
case cop1_op:
if(!(mips_cpu.options & MIPS_CPU_FPU))
if (!cpu_has_fpu)
fcr31 = current->thread.fpu.soft.sr;
else
asm ("cfc1\t%0,$31":"=r" (fcr31));
asm volatile("cfc1\t%0,$31" : "=r" (fcr31));
bit = (insn.i_format.rt >> 2);
bit += (bit != 0);
bit += 23;
......
This diff is collapsed.
This diff is collapsed.
......@@ -13,6 +13,16 @@
#include <asm/stackframe.h>
#include <asm/gdb-stub.h>
/*
* [jsun] We reserves about 2x GDB_FR_SIZE in stack. The lower (addressed)
* part is used to store registers and passed to exception handler.
* The upper part is reserved for "call func" feature where gdb client
* saves some of the regs, setups call frame and passes args.
*
* A trace shows about 200 bytes are used to store about half of all regs.
* The rest should be big enough for frame setup and passing args.
*/
/*
* The low level trap handler
*/
......@@ -38,7 +48,7 @@
nop
1:
move k0,sp
subu sp,k1,GDB_FR_SIZE
subu sp,k1,GDB_FR_SIZE*2 # see comment above
sw k0,GDB_FR_REG29(sp)
sw v0,GDB_FR_REG2(sp)
......@@ -145,9 +155,9 @@
* FPU control registers
*/
mfc1 v0,CP1_STATUS
cfc1 v0,CP1_STATUS
sw v0,GDB_FR_FSR(sp)
mfc1 v0,CP1_REVISION
cfc1 v0,CP1_REVISION
sw v0,GDB_FR_FIR(sp)
/*
......@@ -304,7 +314,7 @@
lw v1,GDB_FR_REG3(sp)
lw v0,GDB_FR_REG2(sp)
lw $1,GDB_FR_REG1(sp)
#ifdef CONFIG_CPU_R3000
#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
lw k0, GDB_FR_EPC(sp)
lw sp, GDB_FR_REG29(sp) /* Deallocate stack */
jr k0
......@@ -321,11 +331,7 @@
END(trap_low)
LEAF(kgdb_read_byte)
.set push
.set noreorder
.set nomacro
4: lb t0, (a0)
.set pop
sb t0, (a1)
li v0, 0
jr ra
......@@ -335,11 +341,7 @@ LEAF(kgdb_read_byte)
END(kgdb_read_byte)
LEAF(kgdb_write_byte)
.set push
.set noreorder
.set nomacro
5: sb a0, (a1)
.set pop
li v0, 0
jr ra
.section __ex_table,"a"
......@@ -349,6 +351,7 @@ LEAF(kgdb_write_byte)
.type kgdbfault@function
.ent kgdbfault
kgdbfault: li v0, -EFAULT
jr ra
.end kgdbfault
This diff is collapsed.
This diff is collapsed.
......@@ -11,11 +11,12 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/sysdev.h>
#include <asm/i8259.h>
#include <asm/io.h>
void enable_8259A_irq(unsigned int irq);
......@@ -30,11 +31,12 @@ void disable_8259A_irq(unsigned int irq);
* moves to arch independent land
*/
spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
static spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
static void end_8259A_irq (unsigned int irq)
{
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
irq_desc[irq].action)
enable_8259A_irq(irq);
}
......@@ -69,9 +71,8 @@ static struct hw_interrupt_type i8259A_irq_type = {
*/
static unsigned int cached_irq_mask = 0xffff;
#define __byte(x,y) (((unsigned char *)&(y))[x])
#define cached_21 (__byte(0,cached_irq_mask))
#define cached_A1 (__byte(1,cached_irq_mask))
#define cached_21 (cached_irq_mask)
#define cached_A1 (cached_irq_mask >> 8)
void disable_8259A_irq(unsigned int irq)
{
......@@ -211,7 +212,7 @@ void mask_and_ack_8259A(unsigned int irq)
printk("spurious 8259A interrupt: IRQ%d.\n", irq);
spurious_irq_mask |= irqmask;
}
irq_err_count++;
atomic_inc(&irq_err_count);
/*
* Theoretically we do not have to handle this IRQ,
* but in Linux this does not cause problems and is
......@@ -221,6 +222,32 @@ void mask_and_ack_8259A(unsigned int irq)
}
}
static int i8259A_resume(struct sys_device *dev)
{
init_8259A(0);
return 0;
}
static struct sysdev_class i8259_sysdev_class = {
set_kset_name("i8259"),
.resume = i8259A_resume,
};
static struct sys_device device_i8259A = {
.id = 0,
.cls = &i8259_sysdev_class,
};
static int __init i8259A_init_sysfs(void)
{
int error = sysdev_class_register(&i8259_sysdev_class);
if (!error)
error = sys_device_register(&device_i8259A);
return error;
}
device_initcall(i8259A_init_sysfs);
void __init init_8259A(int auto_eoi)
{
unsigned long flags;
......@@ -234,7 +261,7 @@ void __init init_8259A(int auto_eoi)
* outb_p - this has to work on a wide range of PC hardware.
*/
outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */
outb_p(0x20 + 0, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */
outb_p(0x00, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x00-0x07 */
outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */
if (auto_eoi)
outb_p(0x03, 0x21); /* master does Auto EOI */
......@@ -242,7 +269,7 @@ void __init init_8259A(int auto_eoi)
outb_p(0x01, 0x21); /* master expects normal EOI */
outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */
outb_p(0x20 + 8, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */
outb_p(0x08, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x08-0x0f */
outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */
outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode
is to be investigated) */
......
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/init_task.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
/*
* Initial task structure.
* Initial thread structure.
*
* We need to make sure that this is 8192-byte aligned due to the
* way process stacks are handled. This is done by making sure
......@@ -20,6 +22,13 @@ struct mm_struct init_mm = INIT_MM(init_mm);
*
* The things we do for performance..
*/
union task_union init_task_union
__attribute__((__section__(".text"))) =
{ INIT_TASK(init_task_union.task) };
union thread_union init_thread_union
__attribute__((__section__(".data.init_task"))) =
{ INIT_THREAD_INFO(init_task) };
/*
* Initial task structure.
*
* All other task structs will be allocated on slabs in fork.c
*/
struct task_struct init_task = INIT_TASK(init_task);
/*
* linux/arch/mips/kernel/ioport.c
*/
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/ioport.h>
/*
* This changes the io permissions bitmap in the current task.
*/
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
{
return -ENOSYS;
}
/*
* sys_iopl has to be used when you want to access the IO ports
* beyond the 0x3ff range: to get the full 65536 ports bitmapped
* you'd need 8kB of bitmaps/process, which is a bit excessive.
*
* Here we just change the eflags value on the stack: we allow
* only the super-user to do it. This depends on the stack-layout
* on system-call entry - see also fork() and the signal handling
* code.
*/
asmlinkage int sys_iopl(long ebx,long ecx,long edx,
long esi, long edi, long ebp, long eax, long ds,
long es, long fs, long gs, long orig_eax,
long eip,long cs,long eflags,long esp,long ss)
{
return -ENOSYS;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment