diff options
Diffstat (limited to 'arch/mips64')
-rw-r--r-- | arch/mips64/defconfig | 19 | ||||
-rw-r--r-- | arch/mips64/defconfig-ip22 | 19 | ||||
-rw-r--r-- | arch/mips64/defconfig-ip27 | 19 | ||||
-rw-r--r-- | arch/mips64/kernel/scall_64.S | 3 | ||||
-rw-r--r-- | arch/mips64/kernel/scall_o32.S | 3 | ||||
-rw-r--r-- | arch/mips64/kernel/semaphore.c | 111 | ||||
-rw-r--r-- | arch/mips64/mm/fault.c | 11 | ||||
-rw-r--r-- | arch/mips64/sgi-ip27/Makefile | 6 | ||||
-rw-r--r-- | arch/mips64/sgi-ip27/ip27-pci-dma.c | 55 |
9 files changed, 227 insertions, 19 deletions
diff --git a/arch/mips64/defconfig b/arch/mips64/defconfig index a07c83b0c..971b6aae6 100644 --- a/arch/mips64/defconfig +++ b/arch/mips64/defconfig @@ -77,7 +77,7 @@ CONFIG_PCI_NAMES=y # CONFIG_BLK_DEV_RAM is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_BLK_DEV_DAC960 is not set -CONFIG_PARIDE_PARPORT=m +# CONFIG_PARIDE is not set # CONFIG_BLK_DEV_IDE_MODES is not set # CONFIG_BLK_DEV_HD is not set @@ -328,23 +328,36 @@ CONFIG_SERIAL_CONSOLE=y # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_BFS_FS_WRITE is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set +# CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y +# CONFIG_DEVPTS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set +# CONFIG_SYSV_FS_WRITE is not set # CONFIG_UDF_FS is not set +# CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set +# CONFIG_UFS_FS_WRITE is not set # # Network File Systems @@ -353,6 +366,7 @@ CONFIG_EXT2_FS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set +# CONFIG_NFSD_V3 is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set @@ -362,10 +376,7 @@ CONFIG_LOCKD=y # Partition Types # # CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_ULTRIX_PARTITION is not set CONFIG_SGI_PARTITION=y -# CONFIG_SUN_PARTITION is not set # CONFIG_NLS is not set CONFIG_KCORE_ELF=y diff --git a/arch/mips64/defconfig-ip22 b/arch/mips64/defconfig-ip22 index 88f4eecd1..43206114d 100644 --- a/arch/mips64/defconfig-ip22 +++ b/arch/mips64/defconfig-ip22 @@ -68,7 +68,7 @@ CONFIG_BINFMT_ELF=y # CONFIG_BLK_DEV_MD is not set # CONFIG_BLK_DEV_RAM is not set # CONFIG_BLK_DEV_XD is not set -CONFIG_PARIDE_PARPORT=m +# CONFIG_PARIDE is not set # CONFIG_BLK_DEV_IDE_MODES is not set # CONFIG_BLK_DEV_HD is not set @@ -250,23 +250,36 @@ CONFIG_VT_CONSOLE=y # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_BFS_FS_WRITE is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set +# CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y +# CONFIG_DEVPTS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set +# CONFIG_SYSV_FS_WRITE is not set # CONFIG_UDF_FS is not set +# CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set +# CONFIG_UFS_FS_WRITE is not set # # Network File Systems @@ -275,6 +288,7 @@ CONFIG_EXT2_FS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set +# CONFIG_NFSD_V3 is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set @@ -284,10 +298,7 @@ CONFIG_LOCKD=y # Partition Types # # CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y CONFIG_SGI_PARTITION=y -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set # CONFIG_NLS is not set # diff --git a/arch/mips64/defconfig-ip27 b/arch/mips64/defconfig-ip27 index a07c83b0c..971b6aae6 100644 --- a/arch/mips64/defconfig-ip27 +++ b/arch/mips64/defconfig-ip27 @@ -77,7 +77,7 @@ CONFIG_PCI_NAMES=y # CONFIG_BLK_DEV_RAM is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_BLK_DEV_DAC960 is not set -CONFIG_PARIDE_PARPORT=m +# CONFIG_PARIDE is not set # CONFIG_BLK_DEV_IDE_MODES is not set # CONFIG_BLK_DEV_HD is not set @@ -328,23 +328,36 @@ CONFIG_SERIAL_CONSOLE=y # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_BFS_FS_WRITE is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set +# CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y +# CONFIG_DEVPTS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set +# CONFIG_SYSV_FS_WRITE is not set # CONFIG_UDF_FS is not set +# CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set +# CONFIG_UFS_FS_WRITE is not set # # Network File Systems @@ -353,6 +366,7 @@ CONFIG_EXT2_FS=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set +# CONFIG_NFSD_V3 is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set @@ -362,10 +376,7 @@ CONFIG_LOCKD=y # Partition Types # # CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_ULTRIX_PARTITION is not set CONFIG_SGI_PARTITION=y -# CONFIG_SUN_PARTITION is not set # CONFIG_NLS is not set CONFIG_KCORE_ELF=y diff --git a/arch/mips64/kernel/scall_64.S b/arch/mips64/kernel/scall_64.S index 0e9d40e17..34ff47b4d 100644 --- a/arch/mips64/kernel/scall_64.S +++ b/arch/mips64/kernel/scall_64.S @@ -1,4 +1,4 @@ -/* $Id: scall_64.S,v 1.2 1999/12/21 12:35:22 ralf Exp $ +/* $Id: scall_64.S,v 1.5 2000/01/24 01:34:16 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -344,3 +344,4 @@ sys_call_table: PTR sys_sendfile PTR sys_ni_syscall PTR sys_ni_syscall + PTR sys_pivot_root /* 4210 */ diff --git a/arch/mips64/kernel/scall_o32.S b/arch/mips64/kernel/scall_o32.S index 7906258d2..57ec8bd53 100644 --- a/arch/mips64/kernel/scall_o32.S +++ b/arch/mips64/kernel/scall_o32.S @@ -1,4 +1,4 @@ -/* $Id: scall_o32.S,v 1.5 2000/02/04 07:40:24 ralf Exp $ +/* $Id: scall_o32.S,v 1.6 2000/02/05 06:47:09 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -407,6 +407,7 @@ illegal_syscall: sys sys_stat64 3 sys sys_lstat64 3 sys sys_fstat64 3 /* 4210 */ + sys sys_pivot_root 2 .endm .macro sys function, nargs diff --git a/arch/mips64/kernel/semaphore.c b/arch/mips64/kernel/semaphore.c index d62b355e1..1f47bd929 100644 --- a/arch/mips64/kernel/semaphore.c +++ b/arch/mips64/kernel/semaphore.c @@ -127,3 +127,114 @@ int __down_trylock(struct semaphore * sem) { return waking_non_zero_trylock(sem); } + +/* + * RW Semaphores + */ +void +__down_read(struct rw_semaphore *sem, int count) +{ + DOWN_VAR; + + retry_down: + if (count < 0) { + /* Wait for the lock to become unbiased. Readers + are non-exclusive. */ + + /* This takes care of granting the lock. */ + up_read(sem); + + add_wait_queue(&sem->wait, &wait); + while (atomic_read(&sem->count) < 0) { + set_task_state(tsk, TASK_UNINTERRUPTIBLE); + if (atomic_read(&sem->count) >= 0) + break; + schedule(); + } + + remove_wait_queue(&sem->wait, &wait); + tsk->state = TASK_RUNNING; + + mb(); + count = atomic_dec_return(&sem->count); + if (count <= 0) + goto retry_down; + } else { + add_wait_queue(&sem->wait, &wait); + + while (1) { + if (test_and_clear_bit(0, &sem->granted)) + break; + set_task_state(tsk, TASK_UNINTERRUPTIBLE); + if ((sem->granted & 1) == 0) + schedule(); + } + + remove_wait_queue(&sem->wait, &wait); + tsk->state = TASK_RUNNING; + } +} + +void +__down_write(struct rw_semaphore *sem, int count) +{ + DOWN_VAR; + + retry_down: + if (count + RW_LOCK_BIAS < 0) { + up_write(sem); + + add_wait_queue_exclusive(&sem->wait, &wait); + + while (atomic_read(&sem->count) < 0) { + set_task_state(tsk, (TASK_UNINTERRUPTIBLE + | TASK_EXCLUSIVE)); + if (atomic_read(&sem->count) >= RW_LOCK_BIAS) + break; + schedule(); + } + + remove_wait_queue(&sem->wait, &wait); + tsk->state = TASK_RUNNING; + + mb(); + count = atomic_sub_return(RW_LOCK_BIAS, &sem->count); + if (count != 0) + goto retry_down; + } else { + /* Put ourselves at the end of the list. */ + add_wait_queue_exclusive(&sem->write_bias_wait, &wait); + + while (1) { + if (test_and_clear_bit(1, &sem->granted)) + break; + set_task_state(tsk, (TASK_UNINTERRUPTIBLE + | TASK_EXCLUSIVE)); + if ((sem->granted & 2) == 0) + schedule(); + } + + remove_wait_queue(&sem->write_bias_wait, &wait); + tsk->state = TASK_RUNNING; + + /* If the lock is currently unbiased, awaken the sleepers. + FIXME: This wakes up the readers early in a bit of a + stampede -> bad! */ + if (atomic_read(&sem->count) >= 0) + wake_up(&sem->wait); + } +} + +void +__rwsem_wake(struct rw_semaphore *sem, unsigned long readers) +{ + if (readers) { + if (test_and_set_bit(0, &sem->granted)) + BUG(); + wake_up(&sem->wait); + } else { + if (test_and_set_bit(1, &sem->granted)) + BUG(); + wake_up(&sem->write_bias_wait); + } +} diff --git a/arch/mips64/mm/fault.c b/arch/mips64/mm/fault.c index 772aa0475..b7a9e2b8f 100644 --- a/arch/mips64/mm/fault.c +++ b/arch/mips64/mm/fault.c @@ -1,4 +1,4 @@ -/* $Id: fault.c,v 1.4 1999/12/04 03:59:00 ralf Exp $ +/* $Id: fault.c,v 1.5 2000/02/04 07:40:24 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -50,6 +50,7 @@ do_page_fault(struct pt_regs *regs, unsigned long write, unsigned long address) struct vm_area_struct * vma; struct task_struct *tsk = current; struct mm_struct *mm = tsk->mm; + int si_code = SEGV_MAPERR; unsigned long fixup; /* @@ -77,6 +78,8 @@ do_page_fault(struct pt_regs *regs, unsigned long write, unsigned long address) * we can handle it.. */ good_area: + si_code = SEGV_ACCERR; + if (write) { if (!(vma->vm_flags & VM_WRITE)) goto bad_area; @@ -109,6 +112,7 @@ bad_area: up(&mm->mmap_sem); if (user_mode(regs)) { + struct siginfo si; tsk->thread.cp0_badvaddr = address; tsk->thread.error_code = write; #if 0 @@ -120,7 +124,10 @@ bad_area: (unsigned long) regs->cp0_epc, (unsigned long) regs->regs[31]); #endif - force_sig(SIGSEGV, tsk); + si.si_signo = SIGSEGV; + si.si_code = si_code; + si.si_addr = (void *) address; + force_sig_info(SIGSEGV, &si, tsk); return; } diff --git a/arch/mips64/sgi-ip27/Makefile b/arch/mips64/sgi-ip27/Makefile index 996bfb1e8..514beaa81 100644 --- a/arch/mips64/sgi-ip27/Makefile +++ b/arch/mips64/sgi-ip27/Makefile @@ -1,4 +1,4 @@ -# $Id$ +# $Id: Makefile,v 1.3 2000/02/04 08:41:40 kanoj Exp $ # # Makefile for the IP27 specific kernel interface routines under Linux. # @@ -10,7 +10,7 @@ L_TARGET = ip27.a L_OBJS = ip27-berr.o ip27-irq.o ip27-irq-glue.o ip27-klconfig.o \ - ip27-memory.o ip27-pci.o ip27-reset.o ip27-setup.o ip27-timer.o \ - ip27-init.o + ip27-memory.o ip27-pci.o ip27-pci-dma.o ip27-reset.o ip27-setup.o \ + ip27-timer.o ip27-init.o include $(TOPDIR)/Rules.make diff --git a/arch/mips64/sgi-ip27/ip27-pci-dma.c b/arch/mips64/sgi-ip27/ip27-pci-dma.c new file mode 100644 index 000000000..81e3e5c6f --- /dev/null +++ b/arch/mips64/sgi-ip27/ip27-pci-dma.c @@ -0,0 +1,55 @@ +/* $Id: ip27-pci-dma.c,v 1.1 2000/02/16 21:22:00 ralf Exp $ + * + * Dynamic DMA mapping support. + * + * On the Origin there is dynamic DMA address translation for all PCI DMA. + * However we don't use this facility yet but rely on the 2gb direct + * mapped DMA window for PCI64. So consistent alloc/free are merely page + * allocation/freeing. The rest of the dynamic DMA mapping interface is + * implemented in <asm/pci.h>. So this code will fail with more than + * 2gb of memory. + */ +#include <linux/types.h> +#include <linux/mm.h> +#include <linux/string.h> +#include <linux/pci.h> +#include <asm/io.h> + +/* Pure 2^n version of get_order */ +extern __inline__ int __get_order(unsigned long size) +{ + int order; + + size = (size-1) >> (PAGE_SHIFT-1); + order = -1; + do { + size >>= 1; + order++; + } while (size); + return order; +} + +void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, + dma_addr_t *dma_handle) +{ + void *ret; + int gfp = GFP_ATOMIC; + int order = __get_order(size); + + if (hwdev == NULL || hwdev->dma_mask != 0xffffffff) + gfp |= GFP_DMA; + ret = (void *)__get_free_pages(gfp, order); + + if (ret != NULL) { + memset(ret, 0, size); + *dma_handle = virt_to_bus(ret); + } + + return ret; +} + +void pci_free_consistent(struct pci_dev *hwdev, size_t size, + void *vaddr, dma_addr_t dma_handle) +{ + free_pages((unsigned long)vaddr, __get_order(size)); +} |