diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
commit | b9ba7aeb165cffecdffb60aec8c3fa8d590d9ca9 (patch) | |
tree | 42d07b0c7246ae2536a702e7c5de9e2732341116 /arch/sparc64 | |
parent | 7406b0a326f2d70ade2671c37d1beef62249db97 (diff) |
Merge with 2.3.99-pre6.
Diffstat (limited to 'arch/sparc64')
31 files changed, 471 insertions, 452 deletions
diff --git a/arch/sparc64/config.in b/arch/sparc64/config.in index 27e5549c0..3ec14ec5c 100644 --- a/arch/sparc64/config.in +++ b/arch/sparc64/config.in @@ -1,4 +1,4 @@ -# $Id: config.in,v 1.107 2000/03/29 11:56:51 davem Exp $ +# $Id: config.in,v 1.108 2000/04/18 05:20:45 davem Exp $ # For a description of the syntax of this configuration file, # see the Configure script. # @@ -187,6 +187,7 @@ if [ "$CONFIG_SCSI" != "n" ]; then fi fi dep_tristate 'Qlogic ISP SCSI support' CONFIG_SCSI_QLOGIC_ISP $CONFIG_SCSI + dep_tristate 'Qlogic ISP FC SCSI support' CONFIG_SCSI_QLOGIC_FC $CONFIG_SCSI fi endmenu diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 2f9febcbe..f969b1b5e 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -223,8 +223,8 @@ CONFIG_BLK_DEV_IDEDMA=y CONFIG_IDEDMA_PCI_EXPERIMENTAL=y # CONFIG_IDEDMA_PCI_WIP is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set -# CONFIG_BLK_DEV_AEC6210 is not set -# CONFIG_AEC6210_TUNING is not set +# CONFIG_BLK_DEV_AEC62XX is not set +# CONFIG_AEC62XX_TUNING is not set # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_WDC_ALI15X3 is not set # CONFIG_BLK_DEV_AMD7409 is not set @@ -246,6 +246,7 @@ CONFIG_BLK_DEV_NS87415=y # CONFIG_BLK_DEV_SIS5513 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_VIA82CXXX_TUNING is not set # CONFIG_IDE_CHIPSETS is not set CONFIG_IDEDMA_AUTO=y CONFIG_BLK_DEV_IDE_MODES=y @@ -293,6 +294,7 @@ CONFIG_SCSI_NCR53C8XX_SYNC=10 # CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set # CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set CONFIG_SCSI_QLOGIC_ISP=y +CONFIG_SCSI_QLOGIC_FC=m # # Fibre Channel support @@ -370,6 +372,7 @@ CONFIG_VIDEO_DEV=y CONFIG_AUTOFS_FS=m CONFIG_AUTOFS4_FS=m # CONFIG_ADFS_FS is not set +# CONFIG_ADFS_FS_RW is not set CONFIG_AFFS_FS=m # CONFIG_HFS_FS is not set CONFIG_BFS_FS=m @@ -379,47 +382,52 @@ CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=m CONFIG_EFS_FS=m CONFIG_CRAMFS=m +CONFIG_RAMFS=m CONFIG_ISO9660_FS=m -# CONFIG_JOLIET is not set +CONFIG_JOLIET=y CONFIG_MINIX_FS=m # CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set CONFIG_HPFS_FS=m CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_DEBUG is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set CONFIG_ROMFS_FS=m CONFIG_EXT2_FS=y CONFIG_SYSV_FS=m -# CONFIG_SYSV_FS_WRITE is not set +CONFIG_SYSV_FS_WRITE=y CONFIG_UDF_FS=m -# CONFIG_UDF_RW is not set +CONFIG_UDF_RW=y CONFIG_UFS_FS=m -# CONFIG_UFS_FS_WRITE is not set +CONFIG_UFS_FS_WRITE=y # # Network File Systems # CONFIG_CODA_FS=m CONFIG_NFS_FS=y +CONFIG_NFS_V3=y # CONFIG_ROOT_NFS is not set CONFIG_NFSD=m -# CONFIG_NFSD_V3 is not set +CONFIG_NFSD_V3=y CONFIG_SUNRPC=y CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y CONFIG_SMB_FS=m CONFIG_NCP_FS=m -# CONFIG_NCPFS_PACKET_SIGNING is not set -# CONFIG_NCPFS_IOCTL_LOCKING is not set -# CONFIG_NCPFS_STRONG is not set -# CONFIG_NCPFS_NFS_NS is not set -# CONFIG_NCPFS_OS2_NS is not set -# CONFIG_NCPFS_SMALLDOS is not set -# CONFIG_NCPFS_MOUNT_SUBDIR is not set -# CONFIG_NCPFS_NDS_DOMAINS is not set -# CONFIG_NCPFS_NLS is not set -# CONFIG_NCPFS_EXTRAS is not set +CONFIG_NCPFS_PACKET_SIGNING=y +CONFIG_NCPFS_IOCTL_LOCKING=y +CONFIG_NCPFS_STRONG=y +CONFIG_NCPFS_NFS_NS=y +CONFIG_NCPFS_OS2_NS=y +CONFIG_NCPFS_SMALLDOS=y +CONFIG_NCPFS_MOUNT_SUBDIR=y +CONFIG_NCPFS_NDS_DOMAINS=y +CONFIG_NCPFS_NLS=y +CONFIG_NCPFS_EXTRAS=y # # Partition Types diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index 5e37c94b4..5c0d38d0d 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.52 2000/03/19 07:00:29 ecd Exp $ +# $Id: Makefile,v 1.53 2000/03/31 04:06:22 davem Exp $ # Makefile for the linux kernel. # # Note! Dependencies are done automagically by 'make dep', which also diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c index c72f7272f..9cc240293 100644 --- a/arch/sparc64/kernel/binfmt_aout32.c +++ b/arch/sparc64/kernel/binfmt_aout32.c @@ -198,7 +198,6 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) { struct exec ex; - int fd; unsigned long error; unsigned long fd_offset; unsigned long rlim; @@ -230,7 +229,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) return retval; /* OK, This is the point of no return */ - current->personality = PER_LINUX; + set_personality(PER_SUNOS); current->mm->end_code = ex.a_text + (current->mm->start_code = N_TXTADDR(ex)); @@ -270,15 +269,8 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) error_time = jiffies; } - fd = get_unused_fd(); - if (fd < 0) - return fd; - get_file(bprm->file); - fd_install(fd, bprm->file); - if (!bprm->file->f_op->mmap) { loff_t pos = fd_offset; - sys_close(fd); do_brk(0, ex.a_text+ex.a_data); bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); @@ -291,7 +283,6 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) fd_offset); if (error != N_TXTADDR(ex)) { - sys_close(fd); send_sig(SIGKILL, current, 0); return error; } @@ -300,20 +291,13 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, fd_offset + ex.a_text); - sys_close(fd); if (error != N_DATADDR(ex)) { send_sig(SIGKILL, current, 0); return error; } } beyond_if: - put_exec_domain(current->exec_domain); - if (current->binfmt && current->binfmt->module) - __MOD_DEC_USE_COUNT(current->binfmt->module); - current->exec_domain = lookup_exec_domain(current->personality); - current->binfmt = &aout32_format; - if (current->binfmt && current->binfmt->module) - __MOD_INC_USE_COUNT(current->binfmt->module); + set_binfmt(&aout32_format); set_brk(current->mm->start_brk, current->mm->brk); diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c index ef07fca85..c7e2fecfb 100644 --- a/arch/sparc64/kernel/ioctl32.c +++ b/arch/sparc64/kernel/ioctl32.c @@ -1,4 +1,4 @@ -/* $Id: ioctl32.c,v 1.87 2000/03/30 02:09:07 davem Exp $ +/* $Id: ioctl32.c,v 1.88 2000/04/14 10:10:34 davem Exp $ * ioctl32.c: Conversion between 32bit and 64bit native ioctls. * * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) @@ -1816,6 +1816,7 @@ struct atm_iobuf32 { #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32) #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32) #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32) +#define ATM_QUERYLOOP32 _IOW('a', ATMIOC_SARCOM+4, struct atmif_sioc32) static struct { unsigned int cmd32; @@ -1836,7 +1837,8 @@ static struct { { ATM_GETSTAT32, ATM_GETSTAT }, { ATM_GETSTATZ32, ATM_GETSTATZ }, { ATM_GETLOOP32, ATM_GETLOOP }, - { ATM_SETLOOP32, ATM_SETLOOP } + { ATM_SETLOOP32, ATM_SETLOOP }, + { ATM_QUERYLOOP32, ATM_QUERYLOOP } }; #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0])) @@ -1996,6 +1998,7 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) case ATM_GETSTATZ: case ATM_GETLOOP: case ATM_SETLOOP: + case ATM_QUERYLOOP: return do_atmif_sioc(fd, cmd, arg); } @@ -3110,6 +3113,7 @@ HANDLE_IOCTL(ATM_GETSTAT32, do_atm_ioctl) HANDLE_IOCTL(ATM_GETSTATZ32, do_atm_ioctl) HANDLE_IOCTL(ATM_GETLOOP32, do_atm_ioctl) HANDLE_IOCTL(ATM_SETLOOP32, do_atm_ioctl) +HANDLE_IOCTL(ATM_QUERYLOOP32, do_atm_ioctl) HANDLE_IOCTL(SONET_GETSTAT, do_atm_ioctl) HANDLE_IOCTL(SONET_GETSTATZ, do_atm_ioctl) HANDLE_IOCTL(SONET_GETDIAG, do_atm_ioctl) diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index d2bc6baf5..6bb01d4c1 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c @@ -1,4 +1,4 @@ -/* $Id: irq.c,v 1.85 2000/03/02 02:00:24 davem Exp $ +/* $Id: irq.c,v 1.86 2000/04/15 06:02:50 davem Exp $ * irq.c: UltraSparc IRQ handling/init/registry. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -538,82 +538,43 @@ out: } /* Only uniprocessor needs this IRQ/BH locking depth, on SMP it - * lives in the per-cpu structure for cache reasons. + * lives in the brlock table for cache reasons. */ #ifndef __SMP__ unsigned int local_irq_count; unsigned int local_bh_count; - -#define irq_enter(cpu, irq) (local_irq_count++) -#define irq_exit(cpu, irq) (local_irq_count--) #else /* Who has global_irq_lock. */ unsigned char global_irq_holder = NO_PROC_ID; -/* This protects IRQ's. */ -spinlock_t global_irq_lock = SPIN_LOCK_UNLOCKED; - -/* Global IRQ locking depth. */ -atomic_t global_irq_count = ATOMIC_INIT(0); - -#define irq_enter(cpu, irq) \ -do { hardirq_enter(cpu); \ - spin_unlock_wait(&global_irq_lock); \ -} while(0) -#define irq_exit(cpu, irq) hardirq_exit(cpu) - static void show(char * str) { int cpu = smp_processor_id(); + int i; printk("\n%s, CPU %d:\n", str, cpu); - printk("irq: %d [%u %u]\n", - atomic_read(&global_irq_count), - cpu_data[0].irq_count, cpu_data[1].irq_count); - printk("bh: %d [%u %u]\n", - (spin_is_locked(&global_bh_lock) ? 1 : 0), - cpu_data[0].bh_count, cpu_data[1].bh_count); + printk("irq: %d [ ", irqs_running()); + for (i = 0; i < smp_num_cpus; i++) + printk("%u ", __brlock_array[i][BR_GLOBALIRQ_LOCK]); + printk("]\nbh: %d [ ", + (spin_is_locked(&global_bh_lock) ? 1 : 0)); + for (i = 0; i < smp_num_cpus; i++) + printk("%u ", cpu_data[i].bh_count); + printk("]\n"); } #define MAXCOUNT 100000000 +#if 0 #define SYNC_OTHER_ULTRAS(x) udelay(x+1) - -static inline void wait_on_irq(int cpu) -{ - int count = MAXCOUNT; - for(;;) { - membar("#LoadLoad"); - if (!atomic_read (&global_irq_count)) { - if (local_bh_count || ! spin_is_locked(&global_bh_lock)) - break; - } - spin_unlock (&global_irq_lock); - membar("#StoreLoad | #StoreStore"); - for(;;) { - if (!--count) { - show("wait_on_irq"); - count = ~0; - } - __sti(); - SYNC_OTHER_ULTRAS(cpu); - __cli(); - if (atomic_read(&global_irq_count)) - continue; - if (spin_is_locked (&global_irq_lock)) - continue; - if (!local_bh_count && spin_is_locked (&global_bh_lock)) - continue; - if (spin_trylock(&global_irq_lock)) - break; - } - } -} +#else +#define SYNC_OTHER_ULTRAS(x) membar("#Sync"); +#endif void synchronize_irq(void) { - if (atomic_read(&global_irq_count)) { + if (irqs_running()) { cli(); sti(); } @@ -621,15 +582,37 @@ void synchronize_irq(void) static inline void get_irqlock(int cpu) { - if (! spin_trylock(&global_irq_lock)) { - if ((unsigned char) cpu == global_irq_holder) - return; - do { - while (spin_is_locked (&global_irq_lock)) - membar("#LoadLoad"); - } while(! spin_trylock(&global_irq_lock)); + int count; + + if ((unsigned char)cpu == global_irq_holder) + return; + + count = MAXCOUNT; +again: + br_write_lock(BR_GLOBALIRQ_LOCK); + for (;;) { + spinlock_t *lock; + + if (!irqs_running() && + (local_bh_count || !spin_is_locked(&global_bh_lock))) + break; + + br_write_unlock(BR_GLOBALIRQ_LOCK); + lock = &__br_write_locks[BR_GLOBALIRQ_LOCK].lock; + while (irqs_running() || + spin_is_locked(lock) || + (!local_bh_count && spin_is_locked(&global_bh_lock))) { + if (!--count) { + show("wait_on_irq"); + count = (~0 >> 1); + } + __sti(); + SYNC_OTHER_ULTRAS(cpu); + __cli(); + } + goto again; } - wait_on_irq(cpu); + global_irq_holder = cpu; } diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c index 98b41d079..5cd905244 100644 --- a/arch/sparc64/kernel/pci_common.c +++ b/arch/sparc64/kernel/pci_common.c @@ -1,4 +1,4 @@ -/* $Id: pci_common.c,v 1.7 2000/03/25 05:18:11 davem Exp $ +/* $Id: pci_common.c,v 1.11 2000/04/26 10:48:02 davem Exp $ * pci_common.c: PCI controller common support. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -66,6 +66,27 @@ static void pci_device_delete(struct pci_dev *pdev) kfree(pdev); } +/* Older versions of OBP on PCI systems encode 64-bit MEM + * space assignments incorrectly, this fixes them up. + */ +static void __init fixup_obp_assignments(struct pcidev_cookie *pcp) +{ + int i; + + for (i = 0; i < pcp->num_prom_assignments; i++) { + struct linux_prom_pci_registers *ap; + int space; + + ap = &pcp->prom_assignments[i]; + space = ap->phys_hi >> 24; + if ((space & 0x3) == 2 && + (space & 0x4) != 0) { + ap->phys_hi &= ~(0x7 << 24); + ap->phys_hi |= 0x3 << 24; + } + } +} + /* Fill in the PCI device cookie sysdata for the given * PCI device. This cookie is the means by which one * can get to OBP and PCI controller specific information @@ -147,6 +168,8 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm, (err / sizeof(pcp->prom_assignments[0])); } + fixup_obp_assignments(pcp); + pdev->sysdata = pcp; } @@ -219,10 +242,15 @@ __init get_root_resource(struct linux_prom_pci_registers *ap, return &pbm->mem_space; case 3: + /* 64-bit MEM space, these are allocated out of + * the 32-bit mem_space range for the PBM, ie. + * we just zero out the upper 32-bits. + */ + return &pbm->mem_space; + default: - /* 64-bit MEM space, unsupported. */ - printk("PCI: 64-bit MEM assignment??? " - "Tell davem@redhat.com about it!\n"); + printk("PCI: What is resource space %x? " + "Tell davem@redhat.com about it!\n", space); return NULL; }; } @@ -231,6 +259,7 @@ static struct resource * __init get_device_resource(struct linux_prom_pci_registers *ap, struct pci_dev *pdev) { + struct resource *res; int breg = (ap->phys_hi & 0xff); int space = (ap->phys_hi >> 24) & 3; @@ -240,7 +269,8 @@ __init get_device_resource(struct linux_prom_pci_registers *ap, if (space != 2) bad_assignment(ap, NULL, 0); - return &pdev->resource[PCI_ROM_RESOURCE]; + res = &pdev->resource[PCI_ROM_RESOURCE]; + break; case PCI_BASE_ADDRESS_0: case PCI_BASE_ADDRESS_1: @@ -248,12 +278,16 @@ __init get_device_resource(struct linux_prom_pci_registers *ap, case PCI_BASE_ADDRESS_3: case PCI_BASE_ADDRESS_4: case PCI_BASE_ADDRESS_5: - return &pdev->resource[(breg - PCI_BASE_ADDRESS_0) / 4]; + res = &pdev->resource[(breg - PCI_BASE_ADDRESS_0) / 4]; + break; default: bad_assignment(ap, NULL, 0); - return NULL; + res = NULL; + break; }; + + return res; } static void __init pdev_record_assignments(struct pci_pbm_info *pbm, @@ -281,6 +315,31 @@ static void __init pdev_record_assignments(struct pci_pbm_info *pbm, if ((res->start & 0xffffffffUL) != ap->phys_lo) bad_assignment(ap, res, 1); + /* If it is a 64-bit MEM space assignment, verify that + * the resource is too and that the upper 32-bits match. + */ + if (((ap->phys_hi >> 24) & 3) == 3) { + if (((res->flags & IORESOURCE_MEM) == 0) || + ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) + != PCI_BASE_ADDRESS_MEM_TYPE_64)) + bad_assignment(ap, res, 1); + if ((res->start >> 32) != ap->phys_mid) + bad_assignment(ap, res, 1); + + /* PBM cannot generate cpu initiated PIOs + * to the full 64-bit space. Therefore the + * upper 32-bits better be zero. If it is + * not, just skip it and we will assign it + * properly ourselves. + */ + if ((res->start >> 32) != 0UL) { + printk(KERN_ERR "PCI: OBP assigns out of range MEM address " + "%016lx for region %ld on device %s\n", + res->start, (res - &pdev->resource[0]), pdev->name); + continue; + } + } + /* Adjust the resource into the physical address space * of this PBM. */ @@ -425,13 +484,21 @@ static int __init pci_intmap_match(struct pci_dev *pdev, unsigned int *interrupt return 0; /* If we are underneath a PCI bridge, use PROM register - * property of parent bridge. + * property of the parent bridge which is closest to + * the PBM. */ if (pdev->bus->number != pbm->pci_first_busno) { struct pcidev_cookie *bus_pcp; + struct pci_dev *pwalk; int offset; - bus_pcp = pdev->bus->self->sysdata; + pwalk = pdev->bus->self; + while (pwalk->bus && + pwalk->bus->number != pbm->pci_first_busno) + pwalk = pwalk->bus->self; + + bus_pcp = pwalk->bus->self->sysdata; + pregs = bus_pcp->prom_regs; offset = prom_getint(bus_pcp->prom_node, "fcode-rom-offset"); diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c index a45fe4740..8d7db0c9b 100644 --- a/arch/sparc64/kernel/pci_psycho.c +++ b/arch/sparc64/kernel/pci_psycho.c @@ -1,4 +1,4 @@ -/* $Id: pci_psycho.c,v 1.15 2000/03/25 05:18:11 davem Exp $ +/* $Id: pci_psycho.c,v 1.16 2000/04/15 10:06:16 davem Exp $ * pci_psycho.c: PSYCHO/U2P specific PCI controller support. * * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu) @@ -1074,22 +1074,34 @@ static void __init psycho_base_address_update(struct pci_dev *pdev, int resource { struct pcidev_cookie *pcp = pdev->sysdata; struct pci_pbm_info *pbm = pcp->pbm; - struct resource *res = &pdev->resource[resource]; - struct resource *root; + struct resource *res, *root; u32 reg; - int where, size; + int where, size, is_64bit; + res = &pdev->resource[resource]; + where = PCI_BASE_ADDRESS_0 + (resource * 4); + + is_64bit = 0; if (res->flags & IORESOURCE_IO) root = &pbm->io_space; - else + else { root = &pbm->mem_space; + if ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) + == PCI_BASE_ADDRESS_MEM_TYPE_64) + is_64bit = 1; + } - where = PCI_BASE_ADDRESS_0 + (resource * 4); size = res->end - res->start; pci_read_config_dword(pdev, where, ®); reg = ((reg & size) | (((u32)(res->start - root->start)) & ~size)); pci_write_config_dword(pdev, where, reg); + + /* This knows that the upper 32-bits of the address + * must be zero. Our PCI common layer enforces this. + */ + if (is_64bit) + pci_write_config_dword(pdev, where + 4, 0); } /* We have to do the config space accesses by hand, thus... */ diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index a55772179..99f7ba8ad 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c @@ -1,4 +1,4 @@ -/* $Id: pci_sabre.c,v 1.16 2000/03/25 05:18:12 davem Exp $ +/* $Id: pci_sabre.c,v 1.19 2000/04/15 13:07:51 davem Exp $ * pci_sabre.c: Sabre specific PCI controller support. * * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu) @@ -1012,22 +1012,35 @@ static void __init sabre_base_address_update(struct pci_dev *pdev, int resource) struct pcidev_cookie *pcp = pdev->sysdata; struct pci_pbm_info *pbm = pcp->pbm; struct pci_controller_info *p = pbm->parent; - struct resource *res = &pdev->resource[resource]; + struct resource *res; unsigned long base; u32 reg; - int where, size; + int where, size, is_64bit; + res = &pdev->resource[resource]; + where = PCI_BASE_ADDRESS_0 + (resource * 4); + + is_64bit = 0; if (res->flags & IORESOURCE_IO) base = p->controller_regs + SABRE_IOSPACE; - else + else { base = p->controller_regs + SABRE_MEMSPACE; + if ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) + == PCI_BASE_ADDRESS_MEM_TYPE_64) + is_64bit = 1; + } - where = PCI_BASE_ADDRESS_0 + (resource * 4); size = res->end - res->start; pci_read_config_dword(pdev, where, ®); reg = ((reg & size) | (((u32)(res->start - base)) & ~size)); pci_write_config_dword(pdev, where, reg); + + /* This knows that the upper 32-bits of the address + * must be zero. Our PCI common layer enforces this. + */ + if (is_64bit) + pci_write_config_dword(pdev, where + 4, 0); } static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus) @@ -1050,6 +1063,20 @@ static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre /* Status register bits are "write 1 to clear". */ sabre_write_word(pdev, PCI_STATUS, 0xffff); sabre_write_word(pdev, PCI_SEC_STATUS, 0xffff); + + /* Use a primary/seconday latency timer value + * of 64. + */ + sabre_write_byte(pdev, PCI_LATENCY_TIMER, 64); + sabre_write_byte(pdev, PCI_SEC_LATENCY_TIMER, 64); + + /* Enable reporting/forwarding of master aborts, + * parity, and SERR. + */ + sabre_write_byte(pdev, PCI_BRIDGE_CONTROL, + (PCI_BRIDGE_CTL_PARITY | + PCI_BRIDGE_CTL_SERR | + PCI_BRIDGE_CTL_MASTER_ABORT)); } } } @@ -1086,17 +1113,6 @@ static void __init sabre_scan_bus(struct pci_controller_info *p) sabre_bus = pci_scan_bus(p->pci_first_busno, p->pci_ops, &p->pbm_A); - - { - unsigned int devfn; - u8 *addr; - - devfn = PCI_DEVFN(0, 0); - addr = sabre_pci_config_mkaddr(&p->pbm_A, 0, - devfn, PCI_LATENCY_TIMER); - pci_config_write8(addr, 32); - } - apb_init(p, sabre_bus); walk = &sabre_bus->children; diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index e612d0200..ccf0c03bf 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -1,4 +1,4 @@ -/* $Id: power.c,v 1.5 1999/12/19 23:28:00 davem Exp $ +/* $Id: power.c,v 1.6 2000/04/13 00:59:59 davem Exp $ * power.c: Power management driver. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -55,8 +55,7 @@ static int powerd(void *__unused) static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; char *argv[] = { "/usr/bin/shutdown", "-h", "now", NULL }; - current->session = 1; - current->pgrp = 1; + daemonize(); sprintf(current->comm, "powerd"); again: diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 8ac030324..fb0e8f411 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.105 2000/03/26 09:13:48 davem Exp $ +/* $Id: process.c,v 1.106 2000/04/15 06:02:50 davem Exp $ * arch/sparc64/kernel/process.c * * Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu) @@ -269,9 +269,8 @@ void __show_regs(struct pt_regs * regs) unsigned long flags; spin_lock_irqsave(®dump_lock, flags); - printk("CPU[%d]: local_irq_count[%u] global_irq_count[%d]\n", - smp_processor_id(), local_irq_count, - atomic_read(&global_irq_count)); + printk("CPU[%d]: local_irq_count[%u] irqs_running[%d]\n", + smp_processor_id(), local_irq_count, irqs_running()); #endif printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x\n", regs->tstate, regs->tpc, regs->tnpc, regs->y); diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index c582be060..f061c417f 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c @@ -68,7 +68,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) static void pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr) { - if (current->personality & PER_BSD) + if (current->personality == PER_SUNOS) pt_succ_return (regs, val); else pt_succ_return_linux (regs, val, addr); @@ -164,8 +164,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs) goto out; } - if (((current->personality & PER_BSD) && (request == PTRACE_SUNATTACH)) - || (!(current->personality & PER_BSD) && (request == PTRACE_ATTACH))) { + if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH) + || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) { unsigned long flags; if(child == current) { @@ -203,9 +203,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) pt_succ_return(regs, 0); goto out; } - if (!(child->flags & PF_PTRACED) - && ((current->personality & PER_BSD) && (request != PTRACE_SUNATTACH)) - && (!(current->personality & PER_BSD) && (request != PTRACE_ATTACH))) { + if (!(child->flags & PF_PTRACED)) { pt_error_return(regs, ESRCH); goto out; } diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c index c9a0d4a59..602ee9ca2 100644 --- a/arch/sparc64/kernel/sbus.c +++ b/arch/sparc64/kernel/sbus.c @@ -1,4 +1,4 @@ -/* $Id: sbus.c,v 1.10 2000/03/10 07:52:08 davem Exp $ +/* $Id: sbus.c,v 1.11 2000/04/14 09:13:04 davem Exp $ * sbus.c: UltraSparc SBUS controller support. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -315,7 +315,7 @@ void sbus_free_consistent(struct sbus_dev *sdev, size_t size, void *cpu, dma_add dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t size, int dir) { struct sbus_iommu *iommu = sdev->bus->iommu; - unsigned long npages, phys_base, flags; + unsigned long npages, pbase, flags; iopte_t *iopte; u32 dma_base, offset; unsigned long iopte_bits; @@ -323,10 +323,10 @@ dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t size, int di if (dir == SBUS_DMA_NONE) BUG(); - phys_base = (unsigned long) ptr; - offset = (u32) (phys_base & ~PAGE_MASK); - size = (PAGE_ALIGN(phys_base + size) - (phys_base & PAGE_MASK)); - phys_base = (unsigned long) __pa(phys_base & PAGE_MASK); + pbase = (unsigned long) ptr; + offset = (u32) (pbase & ~PAGE_MASK); + size = (PAGE_ALIGN(pbase + size) - (pbase & PAGE_MASK)); + pbase = (unsigned long) __pa(pbase & PAGE_MASK); spin_lock_irqsave(&iommu->lock, flags); npages = size >> PAGE_SHIFT; @@ -337,8 +337,8 @@ dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t size, int di if (dir != SBUS_DMA_TODEVICE) iopte_bits |= IOPTE_WRITE; while (npages--) { - *iopte++ = __iopte(iopte_bits | (phys_base & IOPTE_PAGE)); - phys_base += PAGE_SIZE; + *iopte++ = __iopte(iopte_bits | (pbase & IOPTE_PAGE)); + pbase += PAGE_SIZE; } npages = size >> PAGE_SHIFT; spin_unlock_irqrestore(&iommu->lock, flags); diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c index e7a50c150..efd6a64d1 100644 --- a/arch/sparc64/kernel/signal.c +++ b/arch/sparc64/kernel/signal.c @@ -1,4 +1,4 @@ -/* $Id: signal.c,v 1.48 1999/12/15 22:24:52 davem Exp $ +/* $Id: signal.c,v 1.49 2000/04/08 02:11:46 davem Exp $ * arch/sparc64/kernel/signal.c * * Copyright (C) 1991, 1992 Linus Torvalds diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c index 423c5f648..1f5c03716 100644 --- a/arch/sparc64/kernel/signal32.c +++ b/arch/sparc64/kernel/signal32.c @@ -1,4 +1,4 @@ -/* $Id: signal32.c,v 1.60 2000/02/25 06:02:37 jj Exp $ +/* $Id: signal32.c,v 1.62 2000/04/12 08:10:19 davem Exp $ * arch/sparc64/kernel/signal32.c * * Copyright (C) 1991, 1992 Linus Torvalds @@ -750,8 +750,7 @@ static inline void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *reg goto sigsegv; if(pte_present(*ptep)) { - unsigned long page = (unsigned long) - __va(pte_pagenr(*ptep) << PAGE_SHIFT); + unsigned long page = page_address(pte_page(*ptep)); __asm__ __volatile__(" membar #StoreStore @@ -1176,8 +1175,7 @@ static inline void setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs goto sigsegv; if(pte_present(*ptep)) { - unsigned long page = (unsigned long) - __va(pte_pagenr(*ptep) << PAGE_SHIFT); + unsigned long page = page_address(pte_page(*ptep)); __asm__ __volatile__(" membar #StoreStore diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index e9a180d2a..2ef0d1004 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -87,7 +87,6 @@ void __init smp_store_cpu_info(int id) { int i; - cpu_data[id].irq_count = 0; cpu_data[id].bh_count = 0; /* multiplier and counter set by smp_setup_percpu_timer() */ @@ -627,33 +626,7 @@ void smp_promstop_others(void) smp_cross_call(&xcall_promstop, 0, 0, 0); } -static inline void sparc64_do_profile(unsigned long pc, unsigned long o7) -{ - if (prof_buffer && current->pid) { - extern int _stext; - extern int rwlock_impl_begin, rwlock_impl_end; - extern int atomic_impl_begin, atomic_impl_end; - extern int __memcpy_begin, __memcpy_end; - extern int __bitops_begin, __bitops_end; - - if ((pc >= (unsigned long) &atomic_impl_begin && - pc < (unsigned long) &atomic_impl_end) || - (pc >= (unsigned long) &rwlock_impl_begin && - pc < (unsigned long) &rwlock_impl_end) || - (pc >= (unsigned long) &__memcpy_begin && - pc < (unsigned long) &__memcpy_end) || - (pc >= (unsigned long) &__bitops_begin && - pc < (unsigned long) &__bitops_end)) - pc = o7; - - pc -= (unsigned long) &_stext; - pc >>= prof_shift; - - if(pc >= prof_len) - pc = prof_len - 1; - atomic_inc((atomic_t *)&prof_buffer[pc]); - } -} +extern void sparc64_do_profile(unsigned long pc, unsigned long o7); static unsigned long current_tick_offset; @@ -682,40 +655,29 @@ void smp_percpu_timer_interrupt(struct pt_regs *regs) clear_softint((1UL << 0)); do { - if(!user) + if (!user) sparc64_do_profile(regs->tpc, regs->u_regs[UREG_RETPC]); - if(!--prof_counter(cpu)) - { + if (!--prof_counter(cpu)) { if (cpu == boot_cpu_id) { -/* XXX Keep this in sync with irq.c --DaveM */ -#define irq_enter(cpu, irq) \ -do { hardirq_enter(cpu); \ - spin_unlock_wait(&global_irq_lock); \ -} while(0) -#define irq_exit(cpu, irq) hardirq_exit(cpu) - irq_enter(cpu, 0); - kstat.irqs[cpu][0]++; + kstat.irqs[cpu][0]++; timer_tick_interrupt(regs); irq_exit(cpu, 0); - -#undef irq_enter -#undef irq_exit } - if(current->pid) { + if (current->pid) { unsigned int *inc, *inc2; update_one_process(current, 1, user, !user, cpu); - if(--current->counter <= 0) { + if (--current->counter <= 0) { current->counter = 0; current->need_resched = 1; } - if(user) { - if(current->priority < DEF_PRIORITY) { + if (user) { + if (current->priority < DEF_PRIORITY) { inc = &kstat.cpu_nice; inc2 = &kstat.per_cpu_nice[cpu]; } else { @@ -862,7 +824,7 @@ cycles_t cacheflush_time; static void __init smp_tune_scheduling (void) { - unsigned long flush_base, flags, *p; + unsigned long orig_flush_base, flush_base, flags, *p; unsigned int ecache_size, order; cycles_t tick1, tick2, raw; @@ -881,7 +843,8 @@ static void __init smp_tune_scheduling (void) "ecache-size", (512 * 1024)); if (ecache_size > (4 * 1024 * 1024)) ecache_size = (4 * 1024 * 1024); - flush_base = __get_free_pages(GFP_KERNEL, order = get_order(ecache_size)); + orig_flush_base = flush_base = + __get_free_pages(GFP_KERNEL, order = get_order(ecache_size)); if (flush_base != 0UL) { __save_and_cli(flags); @@ -923,7 +886,7 @@ static void __init smp_tune_scheduling (void) */ cacheflush_time = (raw - (raw >> 2)); - free_pages(flush_base, order); + free_pages(orig_flush_base, order); } else { cacheflush_time = ((ecache_size << 2) + (ecache_size << 1)); diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index fc7a8cfe5..f68d6ee9e 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -1,4 +1,4 @@ -/* $Id: sparc64_ksyms.c,v 1.80 2000/03/27 10:38:47 davem Exp $ +/* $Id: sparc64_ksyms.c,v 1.83 2000/04/19 08:38:25 davem Exp $ * arch/sparc64/kernel/sparc64_ksyms.c: Sparc64 specific ksyms support. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -81,6 +81,8 @@ extern int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); extern int sys32_ioctl(unsigned int fd, unsigned int cmd, u32 arg); extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *); extern long sparc32_open(const char * filename, int flags, int mode); +extern int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file *)); +extern int unregister_ioctl32_conversion(unsigned int cmd); extern void bcopy (const char *, char *, int); extern int __ashrdi3(int, int); @@ -129,8 +131,6 @@ EXPORT_SYMBOL(kernel_flag); /* Hard IRQ locking */ EXPORT_SYMBOL(global_irq_holder); -EXPORT_SYMBOL(global_irq_lock); -EXPORT_SYMBOL(global_irq_count); EXPORT_SYMBOL(synchronize_irq); EXPORT_SYMBOL_PRIVATE(global_cli); EXPORT_SYMBOL_PRIVATE(global_sti); @@ -219,6 +219,10 @@ EXPORT_SYMBOL(pci_dma_sync_sg); EXPORT_SYMBOL(pci_dma_supported); #endif +/* IOCTL32 emulation hooks. */ +EXPORT_SYMBOL(register_ioctl32_conversion); +EXPORT_SYMBOL(unregister_ioctl32_conversion); + /* Solaris/SunOS binary compatibility */ EXPORT_SYMBOL(_sigpause_common); @@ -297,8 +301,8 @@ EXPORT_SYMBOL(move_addr_to_user); /* Special internal versions of library functions. */ EXPORT_SYMBOL(__memcpy); EXPORT_SYMBOL(__memset); -EXPORT_SYMBOL(clear_page); -EXPORT_SYMBOL(copy_page); +EXPORT_SYMBOL(_clear_page); +EXPORT_SYMBOL(_copy_page); EXPORT_SYMBOL(clear_user_page); EXPORT_SYMBOL(copy_user_page); EXPORT_SYMBOL(__bzero); diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 82aedbb08..16edc28f6 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc.c,v 1.37 2000/03/17 05:48:46 anton Exp $ +/* $Id: sys_sparc.c,v 1.38 2000/04/13 07:30:34 jj Exp $ * linux/arch/sparc64/kernel/sys_sparc.c * * This file contains various random system calls that @@ -23,6 +23,7 @@ #include <linux/smp_lock.h> #include <linux/malloc.h> #include <linux/ipc.h> +#include <linux/personality.h> #include <asm/uaccess.h> #include <asm/ipc.h> @@ -182,6 +183,33 @@ out: return err; } +extern asmlinkage int sys_newuname(struct new_utsname * name); + +asmlinkage int sparc64_newuname(struct new_utsname * name) +{ + int ret = sys_newuname(name); + + if (current->personality == PER_LINUX32 && !ret) { + ret = copy_to_user(name->machine, "sparc\0\0", 8); + } + return ret; +} + +extern asmlinkage long sys_personality(unsigned long); + +asmlinkage int sparc64_personality(unsigned long personality) +{ + int ret; + lock_kernel(); + if (current->personality == PER_LINUX32 && personality == PER_LINUX) + personality = PER_LINUX32; + ret = sys_personality(personality); + unlock_kernel(); + if (ret == PER_LINUX32) + ret = PER_LINUX; + return ret; +} + /* Linux version of mmap */ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, @@ -232,7 +260,7 @@ asmlinkage long sys64_munmap(unsigned long addr, size_t len) (addr < PAGE_OFFSET && addr + len > -PAGE_OFFSET)) return -EINVAL; down(¤t->mm->mmap_sem); - ret = do_munmap(addr, len); + ret = do_munmap(current->mm, addr, len); up(¤t->mm->mmap_sem); return ret; } diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index b1eb160ad..7bb75f4ae 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc32.c,v 1.142 2000/03/24 04:17:38 davem Exp $ +/* $Id: sys_sparc32.c,v 1.145 2000/04/13 07:30:34 jj Exp $ * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls. * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -3542,6 +3542,18 @@ struct nfsctl_fhparm32 { s32 gf32_version; }; +struct nfsctl_fdparm32 { + struct sockaddr gd32_addr; + s8 gd32_path[NFS_MAXPATHLEN+1]; + s32 gd32_version; +}; + +struct nfsctl_fsparm32 { + struct sockaddr gd32_addr; + s8 gd32_path[NFS_MAXPATHLEN+1]; + s32 gd32_maxlen; +}; + struct nfsctl_arg32 { s32 ca32_version; /* safeguard */ union { @@ -3550,15 +3562,17 @@ struct nfsctl_arg32 { struct nfsctl_export32 u32_export; struct nfsctl_uidmap32 u32_umap; struct nfsctl_fhparm32 u32_getfh; - u32 u32_debug; + struct nfsctl_fdparm32 u32_getfd; + struct nfsctl_fsparm32 u32_getfs; } u; #define ca32_svc u.u32_svc #define ca32_client u.u32_client #define ca32_export u.u32_export #define ca32_umap u.u32_umap #define ca32_getfh u.u32_getfh +#define ca32_getfd u.u32_getfd +#define ca32_getfs u.u32_getfs #define ca32_authd u.u32_authd -#define ca32_debug u.u32_debug }; union nfsctl_res32 { @@ -3689,6 +3703,38 @@ static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32 return err; } +static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) +{ + int err; + + err = __get_user(karg->ca_version, &arg32->ca32_version); + err |= copy_from_user(&karg->ca_getfd.gd_addr, + &arg32->ca32_getfd.gd32_addr, + (sizeof(struct sockaddr))); + err |= copy_from_user(&karg->ca_getfd.gd_path, + &arg32->ca32_getfd.gd32_path, + (NFS_MAXPATHLEN+1)); + err |= __get_user(karg->ca_getfd.gd_version, + &arg32->ca32_getfd.gd32_version); + return err; +} + +static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) +{ + int err; + + err = __get_user(karg->ca_version, &arg32->ca32_version); + err |= copy_from_user(&karg->ca_getfs.gd_addr, + &arg32->ca32_getfs.gd32_addr, + (sizeof(struct sockaddr))); + err |= copy_from_user(&karg->ca_getfs.gd_path, + &arg32->ca32_getfs.gd32_path, + (NFS_MAXPATHLEN+1)); + err |= __get_user(karg->ca_getfs.gd_maxlen, + &arg32->ca32_getfs.gd32_maxlen); + return err; +} + /* This really doesn't need translations, we are only passing * back a union which contains opaque nfs file handle data. */ @@ -3727,6 +3773,7 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct err = nfs_clnt32_trans(karg, arg32); break; case NFSCTL_EXPORT: + case NFSCTL_UNEXPORT: err = nfs_exp32_trans(karg, arg32); break; /* This one is unimplemented, be we're ready for it. */ @@ -3736,6 +3783,12 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct case NFSCTL_GETFH: err = nfs_getfh32_trans(karg, arg32); break; + case NFSCTL_GETFD: + err = nfs_getfd32_trans(karg, arg32); + break; + case NFSCTL_GETFS: + err = nfs_getfs32_trans(karg, arg32); + break; default: err = -EINVAL; break; @@ -3747,7 +3800,12 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct err = sys_nfsservctl(cmd, karg, kres); set_fs(oldfs); - if(!err && cmd == NFSCTL_GETFH) + if (err) + goto done; + + if((cmd == NFSCTL_GETFH) || + (cmd == NFSCTL_GETFD) || + (cmd == NFSCTL_GETFS)) err = nfs_getfh32_res_trans(kres, res32); done: @@ -3922,18 +3980,6 @@ asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) } -extern asmlinkage int sys_newuname(struct new_utsname * name); - -asmlinkage int sys32_newuname(struct new_utsname * name) -{ - int ret = sys_newuname(name); - - if (current->personality == PER_LINUX32 && !ret) { - ret = copy_to_user(name->machine, "sparc\0\0", 8); - } - return ret; -} - extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf, size_t count, loff_t pos); @@ -3955,21 +4001,6 @@ asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf, } -extern asmlinkage long sys_personality(unsigned long); - -asmlinkage int sys32_personality(unsigned long personality) -{ - int ret; - lock_kernel(); - if (current->personality == PER_LINUX32 && personality == PER_LINUX) - personality = PER_LINUX32; - ret = sys_personality(personality); - unlock_kernel(); - if (ret == PER_LINUX32) - ret = PER_LINUX; - return ret; -} - extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count); asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count) diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index 291b174ac..1370d0231 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c @@ -1,4 +1,4 @@ -/* $Id: sys_sunos32.c,v 1.43 2000/03/26 11:28:53 davem Exp $ +/* $Id: sys_sunos32.c,v 1.45 2000/04/13 00:55:49 davem Exp $ * sys_sunos32.c: SunOS binary compatability layer on sparc64. * * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu) @@ -45,6 +45,7 @@ #include <linux/socket.h> #include <linux/in.h> #include <linux/nfs.h> +#include <linux/nfs2.h> #include <linux/nfs_mount.h> /* for sunos_select */ @@ -69,7 +70,6 @@ asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 of down(¤t->mm->mmap_sem); lock_kernel(); - current->personality |= PER_BSD; if(flags & MAP_NORESERVE) { static int cnt; if (cnt++ < 10) @@ -141,7 +141,7 @@ asmlinkage int sunos_brk(u32 baddr) /* Always allow shrinking brk. */ if (brk <= current->mm->brk) { current->mm->brk = brk; - do_munmap(newbrk, oldbrk-newbrk); + do_munmap(current->mm, newbrk, oldbrk-newbrk); goto out; } /* Check against rlimit and stack.. */ @@ -549,7 +549,6 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x) /* SunOS binaries expect that select won't change the tvp contents */ lock_kernel(); - current->personality |= STICKY_TIMEOUTS; ret = sys32_select (width, inp, outp, exp, tvp_x); if (ret == -EINTR && tvp_x) { struct timeval32 *tvp = (struct timeval32 *)A(tvp_x); @@ -685,7 +684,7 @@ static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data) * address to create a socket and bind it to a reserved * port on this system */ - if (copy_from_user(&sunos_mount, data, sizeof(sunos_mount)) + if (copy_from_user(&sunos_mount, data, sizeof(sunos_mount))) return -EFAULT; server_fd = sys_socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -776,14 +775,14 @@ sunos_mount(char *type, char *dir, int flags, void *data) dev_fname = getname(data); } else if(strcmp(type_page, "nfs") == 0) { ret = sunos_nfs_mount (dir_page, flags, data); - goto out2 + goto out2; } else if(strcmp(type_page, "ufs") == 0) { printk("Warning: UFS filesystem mounts unsupported.\n"); ret = -ENODEV; - goto out2 + goto out2; } else if(strcmp(type_page, "proc")) { ret = -ENODEV; - goto out2 + goto out2; } ret = PTR_ERR(dev_fname); if (IS_ERR(dev_fname)) @@ -1214,7 +1213,6 @@ asmlinkage int sunos_open(u32 fname, int flags, int mode) { const char *filename = (const char *)(long)fname; - current->personality |= PER_BSD; return sparc32_open(filename, flags, mode); } @@ -1350,8 +1348,6 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) struct k_sigaction new_ka, old_ka; int ret; - current->personality |= PER_BSD; - if (act) { old_sigset_t32 mask; diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index d86649bf7..eb02486f5 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S @@ -1,4 +1,4 @@ -/* $Id: systbls.S,v 1.71 2000/03/15 02:43:36 davem Exp $ +/* $Id: systbls.S,v 1.72 2000/04/13 07:30:34 jj Exp $ * systbls.S: System call entry point tables for OS compatibility. * The native Linux system call table lives here also. * @@ -56,8 +56,8 @@ sys_call_table32: /*170*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_getdents .word sys_setsid, sys_fchdir, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall /*180*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_sigpending, sys32_query_module - .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_newuname -/*190*/ .word sys32_init_module, sys32_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall + .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sparc64_newuname +/*190*/ .word sys32_init_module, sparc64_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask /*200*/ .word sys_ssetmask, sys_sigsuspend, sys32_newlstat, sys_uselib, old32_readdir .word sys_nis_syscall, sys32_socketcall, sys_syslog, sys_nis_syscall, sys_nis_syscall @@ -115,8 +115,8 @@ sys_call_table: /*170*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_getdents .word sys_setsid, sys_fchdir, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall /*180*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_query_module - .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_newuname -/*190*/ .word sys_init_module, sys_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall + .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sparc64_newuname +/*190*/ .word sys_init_module, sparc64_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys_nis_syscall, sys_getppid, sys_nis_syscall, sys_sgetmask /*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall .word sys_nis_syscall, sys_socketcall, sys_syslog, sys_nis_syscall, sys_nis_syscall diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index e599b48cb..a955e75df 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c @@ -1,4 +1,4 @@ -/* $Id: time.c,v 1.24 2000/03/02 02:00:25 davem Exp $ +/* $Id: time.c,v 1.25 2000/04/13 05:29:44 davem Exp $ * time.c: UltraSparc timer and TOD clock support. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -67,6 +67,34 @@ static __inline__ void timer_check_rtc(void) } } +void sparc64_do_profile(unsigned long pc, unsigned long o7) +{ + if (prof_buffer && current->pid) { + extern int _stext; + extern int rwlock_impl_begin, rwlock_impl_end; + extern int atomic_impl_begin, atomic_impl_end; + extern int __memcpy_begin, __memcpy_end; + extern int __bitops_begin, __bitops_end; + + if ((pc >= (unsigned long) &atomic_impl_begin && + pc < (unsigned long) &atomic_impl_end) || + (pc >= (unsigned long) &rwlock_impl_begin && + pc < (unsigned long) &rwlock_impl_end) || + (pc >= (unsigned long) &__memcpy_begin && + pc < (unsigned long) &__memcpy_end) || + (pc >= (unsigned long) &__bitops_begin && + pc < (unsigned long) &__bitops_end)) + pc = o7; + + pc -= (unsigned long) &_stext; + pc >>= prof_shift; + + if(pc >= prof_len) + pc = prof_len - 1; + atomic_inc((atomic_t *)&prof_buffer[pc]); + } +} + static void timer_interrupt(int irq, void *dev_id, struct pt_regs * regs) { unsigned long ticks, pstate; @@ -74,6 +102,10 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs * regs) write_lock(&xtime_lock); do { +#ifndef __SMP__ + if ((regs->tstate & TSTATE_PRIV) != 0) + sparc64_do_profile(regs->tpc, regs->u_regs[UREG_RETPC]); +#endif do_timer(regs); /* Guarentee that the following sequences execute diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile index e70e28e52..548ef0ac4 100644 --- a/arch/sparc64/lib/Makefile +++ b/arch/sparc64/lib/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.21 2000/03/27 10:38:41 davem Exp $ +# $Id: Makefile,v 1.22 2000/03/31 04:06:23 davem Exp $ # Makefile for Sparc library files.. # diff --git a/arch/sparc64/lib/blockops.S b/arch/sparc64/lib/blockops.S index 9c6a8beba..9668f86d8 100644 --- a/arch/sparc64/lib/blockops.S +++ b/arch/sparc64/lib/blockops.S @@ -1,4 +1,4 @@ -/* $Id: blockops.S,v 1.24 2000/03/27 10:38:41 davem Exp $ +/* $Id: blockops.S,v 1.25 2000/04/13 04:45:58 davem Exp $ * blockops.S: UltraSparc block zero optimized routines. * * Copyright (C) 1996, 1998, 1999, 2000 David S. Miller (davem@redhat.com) @@ -26,9 +26,9 @@ .text .align 32 - .globl copy_page - .type copy_page,@function -copy_page: /* %o0=dest, %o1=src */ + .globl _copy_page + .type _copy_page,@function +_copy_page: /* %o0=dest, %o1=src */ VISEntry membar #LoadStore | #StoreStore | #StoreLoad ldda [%o1] ASI_BLK_P, %f0 @@ -205,9 +205,9 @@ copy_page_using_blkcommit: stda %f16, [%o0] ASI_BLK_COMMIT_P .align 32 - .globl clear_page - .type clear_page,@function -clear_page: /* %o0=dest */ + .globl _clear_page + .type _clear_page,@function +_clear_page: /* %o0=dest */ VISEntryHalf ba,pt %xcc, clear_page_common clr %o4 diff --git a/arch/sparc64/mm/Makefile b/arch/sparc64/mm/Makefile index 039195944..36b871af5 100644 --- a/arch/sparc64/mm/Makefile +++ b/arch/sparc64/mm/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.6 2000/01/31 01:30:49 davem Exp $ +# $Id: Makefile,v 1.7 2000/03/31 04:06:24 davem Exp $ # Makefile for the linux Sparc64-specific parts of the memory manager. # # Note! Dependencies are done automagically by 'make dep', which also diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 0d8152887..37b07d605 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -1,4 +1,4 @@ -/* $Id: fault.c,v 1.45 2000/03/27 10:38:51 davem Exp $ +/* $Id: fault.c,v 1.47 2000/04/25 04:13:25 davem Exp $ * arch/sparc64/mm/fault.c: Page fault handlers for the 64-bit Sparc. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -110,7 +110,8 @@ static unsigned int get_user_insn(unsigned long tpc) if(!pte_present(pte)) goto out; - pa = (pte_pagenr(pte) << PAGE_SHIFT) + (tpc & ~PAGE_MASK); + pa = phys_base + (pte_pagenr(pte) << PAGE_SHIFT); + pa += (tpc & ~PAGE_MASK); /* Use phys bypass so we don't pollute dtlb/dcache. */ __asm__ __volatile__("lduwa [%1] %2, %0" @@ -295,7 +296,7 @@ good_area: } { - int fault = handle_mm_fault(current, vma, + int fault = handle_mm_fault(mm, vma, address, (fault_code & FAULT_CODE_WRITE)); if (fault < 0) diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 1d2049b5f..bef1c3fac 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.149 2000/03/15 14:42:58 jj Exp $ +/* $Id: init.c,v 1.151 2000/04/26 17:09:32 davem Exp $ * arch/sparc64/mm/init.c * * Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu) @@ -738,22 +738,17 @@ pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset) */ pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset, unsigned long color) { - unsigned long paddr = __get_free_pages(GFP_KERNEL, 1); + struct page *page = alloc_pages(GFP_KERNEL, 1); - if (paddr) { - struct page *page2 = mem_map + MAP_NR(paddr + PAGE_SIZE); + if (page) { unsigned long *to_free; + unsigned long paddr; pte_t *pte; - /* Set count of second page, so we can free it - * seperately later on. - */ - atomic_set(&page2->count, 1); - - /* Clear out both pages now. */ + set_page_count((page + 1), 1); + paddr = page_address(page); memset((char *)paddr, 0, (PAGE_SIZE << 1)); - /* Determine which page we give to this request. */ if (!color) { pte = (pte_t *) paddr; to_free = (unsigned long *) (paddr + PAGE_SIZE); @@ -804,50 +799,42 @@ void sparc_ultra_dump_dtlb(void) } } -#undef DEBUG_BOOTMEM - extern unsigned long cmdline_memory_size; -unsigned long __init bootmem_init(void) +unsigned long __init bootmem_init(unsigned long *pages_avail) { unsigned long bootmap_size, start_pfn, end_pfn; unsigned long end_of_phys_memory = 0UL; - unsigned long bootmap_pfn; + unsigned long bootmap_pfn, bytes_avail, size; int i; - /* XXX It is a bit ambiguous here, whether we should - * XXX treat the user specified mem=xxx as total wanted - * XXX physical memory, or as a limit to the upper - * XXX physical address we allow. For now it is the - * XXX latter. -DaveM - */ -#ifdef DEBUG_BOOTMEM - prom_printf("bootmem_init: Scan sp_banks, "); -#endif + + bytes_avail = 0UL; for (i = 0; sp_banks[i].num_bytes != 0; i++) { end_of_phys_memory = sp_banks[i].base_addr + sp_banks[i].num_bytes; + bytes_avail += sp_banks[i].num_bytes; if (cmdline_memory_size) { - if (end_of_phys_memory > cmdline_memory_size) { - if (cmdline_memory_size < sp_banks[i].base_addr) { - end_of_phys_memory = - sp_banks[i-1].base_addr + - sp_banks[i-1].num_bytes; + if (bytes_avail > cmdline_memory_size) { + unsigned long slack = bytes_avail - cmdline_memory_size; + + bytes_avail -= slack; + end_of_phys_memory -= slack; + + sp_banks[i].num_bytes -= slack; + if (sp_banks[i].num_bytes == 0) { sp_banks[i].base_addr = 0xdeadbeef; - sp_banks[i].num_bytes = 0; } else { - sp_banks[i].num_bytes -= - (end_of_phys_memory - - cmdline_memory_size); - end_of_phys_memory = cmdline_memory_size; - sp_banks[++i].base_addr = 0xdeadbeef; - sp_banks[i].num_bytes = 0; + sp_banks[i+1].num_bytes = 0; + sp_banks[i+1].base_addr = 0xdeadbeef; } break; } } } + *pages_avail = bytes_avail >> PAGE_SHIFT; + /* Start with page aligned address of last symbol in kernel * image. The kernel is hard mapped below PAGE_OFFSET in a * 4MB locked TLB translation. @@ -886,50 +873,40 @@ unsigned long __init bootmem_init(void) } #endif /* Initialize the boot-time allocator. */ -#ifdef DEBUG_BOOTMEM - prom_printf("init_bootmem(spfn[%lx],bpfn[%lx],epfn[%lx])\n", - start_pfn, bootmap_pfn, end_pfn); -#endif - bootmap_size = init_bootmem(bootmap_pfn, end_pfn); + bootmap_size = init_bootmem_node(0, bootmap_pfn, phys_base>>PAGE_SHIFT, end_pfn); /* Now register the available physical memory with the * allocator. */ - for (i = 0; sp_banks[i].num_bytes != 0; i++) { -#ifdef DEBUG_BOOTMEM - prom_printf("free_bootmem: base[%lx] size[%lx]\n", - sp_banks[i].base_addr, - sp_banks[i].num_bytes); -#endif + for (i = 0; sp_banks[i].num_bytes != 0; i++) free_bootmem(sp_banks[i].base_addr, sp_banks[i].num_bytes); - } - /* Reserve the kernel text/data/bss, the bootmem bootmap and initrd. */ -#ifdef DEBUG_BOOTMEM -#ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start) - prom_printf("reserve_bootmem: base[%lx] size[%lx]\n", - initrd_start, initrd_end - initrd_start); -#endif - prom_printf("reserve_bootmem: base[%lx] size[%lx]\n", - phys_base, (start_pfn << PAGE_SHIFT) - phys_base); - prom_printf("reserve_bootmem: base[%lx] size[%lx]\n", - (bootmap_pfn << PAGE_SHIFT), bootmap_size); -#endif #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { - reserve_bootmem(initrd_start, initrd_end - initrd_start); + size = initrd_end - initrd_start; + + /* Resert the initrd image area. */ + reserve_bootmem(initrd_start, size); + *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; + initrd_start += PAGE_OFFSET; initrd_end += PAGE_OFFSET; } #endif - reserve_bootmem(phys_base, (start_pfn << PAGE_SHIFT) - phys_base); - reserve_bootmem((bootmap_pfn << PAGE_SHIFT), bootmap_size); + /* Reserve the kernel text/data/bss. */ + size = (start_pfn << PAGE_SHIFT) - phys_base; + reserve_bootmem(phys_base, size); + *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; + + /* Reserve the bootmem map. We do not account for it + * in pages_avail because we will release that memory + * in free_all_bootmem. + */ + size = bootmap_size; + reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size); + *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; -#ifdef DEBUG_BOOTMEM - prom_printf("init_bootmem: return end_pfn[%lx]\n", end_pfn); -#endif return end_pfn; } @@ -946,7 +923,7 @@ void __init paging_init(void) extern unsigned int sparc64_vpte_patchme2[1]; unsigned long alias_base = phys_base + PAGE_OFFSET; unsigned long second_alias_page = 0; - unsigned long pt, flags, end_pfn; + unsigned long pt, flags, end_pfn, pages_avail; unsigned long shift = alias_base - ((unsigned long)&empty_zero_page); set_bit(0, mmu_context_bmap); @@ -1001,7 +978,8 @@ void __init paging_init(void) flushi((long)&sparc64_vpte_patchme1[0]); /* Setup bootmem... */ - last_valid_pfn = end_pfn = bootmem_init(); + pages_avail = 0; + last_valid_pfn = end_pfn = bootmem_init(&pages_avail); #ifdef CONFIG_SUN_SERIAL /* This does not logically belong here, but we need to @@ -1039,10 +1017,20 @@ void __init paging_init(void) flush_tlb_all(); { - unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0}; + unsigned long zones_size[MAX_NR_ZONES]; + unsigned long zholes_size[MAX_NR_ZONES]; + unsigned long npages; + int znum; - zones_size[ZONE_DMA] = end_pfn; - free_area_init(zones_size); + for (znum = 0; znum < MAX_NR_ZONES; znum++) + zones_size[znum] = zholes_size[znum] = 0; + + npages = end_pfn - (phys_base >> PAGE_SHIFT); + zones_size[ZONE_DMA] = npages; + zholes_size[ZONE_DMA] = npages - pages_avail; + + free_area_init_node(0, NULL, zones_size, + phys_base, zholes_size); } device_scan(); @@ -1139,9 +1127,6 @@ static void __init taint_real_pages(void) struct sparc_phys_banks saved_sp_banks[SPARC_PHYS_BANKS]; int i; -#ifdef DEBUG_BOOTMEM - prom_printf("taint_real_pages: Rescan sp_banks[].\n"); -#endif for (i = 0; i < SPARC_PHYS_BANKS; i++) { saved_sp_banks[i].base_addr = sp_banks[i].base_addr; @@ -1176,10 +1161,6 @@ static void __init taint_real_pages(void) goto do_next_page; } } -#ifdef DEBUG_BOOTMEM - prom_printf("taint: Page went away, reserve page %lx.\n", - old_start); -#endif reserve_bootmem(old_start, PAGE_SIZE); do_next_page: @@ -1188,70 +1169,6 @@ static void __init taint_real_pages(void) } } -void __init free_mem_map_range(struct page *first, struct page *last) -{ - first = (struct page *) PAGE_ALIGN((unsigned long)first); - last = (struct page *) ((unsigned long)last & PAGE_MASK); -#ifdef DEBUG_BOOTMEM - prom_printf("[%p,%p] ", first, last); -#endif - while (first < last) { - ClearPageReserved(mem_map + MAP_NR(first)); - set_page_count(mem_map + MAP_NR(first), 1); - free_page((unsigned long)first); - num_physpages++; - - first = (struct page *)((unsigned long)first + PAGE_SIZE); - } -} - -/* Walk through holes in sp_banks regions, if the mem_map array - * areas representing those holes consume a page or more, free - * up such pages. This helps a lot on machines where physical - * ram is configured such that it begins at some hugh value. - * - * The sp_banks array is sorted by base address. - */ -void __init free_unused_mem_map(void) -{ - int i; - -#ifdef DEBUG_BOOTMEM - prom_printf("free_unused_mem_map: "); -#endif - for (i = 0; sp_banks[i].num_bytes; i++) { - if (i == 0) { - struct page *first, *last; - - first = mem_map; - last = &mem_map[sp_banks[i].base_addr >> PAGE_SHIFT]; - free_mem_map_range(first, last); - } else { - struct page *first, *last; - unsigned long prev_end; - - prev_end = sp_banks[i-1].base_addr + - sp_banks[i-1].num_bytes; - prev_end = PAGE_ALIGN(prev_end); - first = &mem_map[prev_end >> PAGE_SHIFT]; - last = &mem_map[sp_banks[i].base_addr >> PAGE_SHIFT]; - - free_mem_map_range(first, last); - - if (!sp_banks[i+1].num_bytes) { - prev_end = sp_banks[i].base_addr + - sp_banks[i].num_bytes; - first = &mem_map[prev_end >> PAGE_SHIFT]; - last = &mem_map[last_valid_pfn]; - free_mem_map_range(first, last); - } - } - } -#ifdef DEBUG_BOOTMEM - prom_printf("\n"); -#endif -} - void __init mem_init(void) { unsigned long codepages, datapages, initpages; @@ -1279,16 +1196,10 @@ void __init mem_init(void) taint_real_pages(); - max_mapnr = last_valid_pfn; + max_mapnr = last_valid_pfn - (phys_base >> PAGE_SHIFT); high_memory = __va(last_valid_pfn << PAGE_SHIFT); -#ifdef DEBUG_BOOTMEM - prom_printf("mem_init: Calling free_all_bootmem().\n"); -#endif num_physpages = free_all_bootmem(); -#if 0 - free_unused_mem_map(); -#endif codepages = (((unsigned long) &etext) - ((unsigned long)&_start)); codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT; datapages = (((unsigned long) &edata) - ((unsigned long)&etext)); @@ -1317,19 +1228,6 @@ void __init mem_init(void) datapages << (PAGE_SHIFT-10), initpages << (PAGE_SHIFT-10), PAGE_OFFSET, (last_valid_pfn << PAGE_SHIFT)); - - /* NOTE NOTE NOTE NOTE - * Please keep track of things and make sure this - * always matches the code in mm/page_alloc.c -DaveM - */ - i = nr_free_pages() >> 7; - if (i < 48) - i = 48; - if (i > 256) - i = 256; - freepages.min = i; - freepages.low = i << 1; - freepages.high = freepages.low + i; } void free_initmem (void) diff --git a/arch/sparc64/prom/Makefile b/arch/sparc64/prom/Makefile index 88ca5251b..04471ab85 100644 --- a/arch/sparc64/prom/Makefile +++ b/arch/sparc64/prom/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.5 1999/12/21 04:02:26 davem Exp $ +# $Id: Makefile,v 1.6 2000/03/31 04:06:25 davem Exp $ # Makefile for the Sun Boot PROM interface library under # Linux. # diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c index 8d6404fea..50b287080 100644 --- a/arch/sparc64/prom/misc.c +++ b/arch/sparc64/prom/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.16 1999/11/19 05:53:04 davem Exp $ +/* $Id: misc.c,v 1.17 2000/04/15 06:02:50 davem Exp $ * misc.c: Miscellaneous prom functions that don't belong * anywhere else. * @@ -64,7 +64,7 @@ prom_cmdline(void) * on SMP, we need to drop the IRQ locks we hold. */ #ifdef __SMP__ - hardirq_exit(smp_processor_id()); + irq_exit(smp_processor_id(), 0); smp_capture(); #else local_irq_count--; @@ -74,8 +74,8 @@ prom_cmdline(void) #ifdef __SMP__ smp_release(); - hardirq_enter(smp_processor_id()); - spin_unlock_wait(&global_irq_lock); + irq_enter(smp_processor_id(), 0); + spin_unlock_wait(&__br_write_locks[BR_GLOBALIRQ_LOCK].lock); #else local_irq_count++; #endif diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c index 2c17d664d..57e50cd8d 100644 --- a/arch/sparc64/solaris/fs.c +++ b/arch/sparc64/solaris/fs.c @@ -1,4 +1,4 @@ -/* $Id: fs.c,v 1.17 2000/03/10 04:43:30 davem Exp $ +/* $Id: fs.c,v 1.18 2000/04/08 02:11:54 davem Exp $ * fs.c: fs related syscall emulation for Solaris * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -506,7 +506,7 @@ asmlinkage int solaris_fstatvfs(unsigned int fd, u32 buf) unlock_kernel(); fput(file); } -out: + return error; } diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c index c9341b0fd..ef4c9aa01 100644 --- a/arch/sparc64/solaris/misc.c +++ b/arch/sparc64/solaris/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.23 2000/03/13 21:57:34 davem Exp $ +/* $Id: misc.c,v 1.26 2000/04/14 09:59:02 davem Exp $ * misc.c: Miscelaneous syscall emulation for Solaris * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -54,7 +54,8 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o unsigned long retval, ret_type; lock_kernel(); - current->personality |= PER_SVR4; + /* Do we need it here? */ + set_personality(PER_SVR4); if (flags & MAP_NORESERVE) { static int cnt = 0; @@ -719,11 +720,7 @@ asmlinkage int do_sol_unimplemented(struct pt_regs *regs) asmlinkage void solaris_register(void) { - lock_kernel(); - current->personality = PER_SVR4; - put_exec_domain(current->exec_domain); - current->exec_domain = lookup_exec_domain(current->personality); - unlock_kernel(); + set_personality(PER_SVR4); } extern long solaris_to_linux_signals[], linux_to_solaris_signals[]; |